home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / g++1.68k / cplus-lex.c < prev    next >
C/C++ Source or Header  |  1990-04-13  |  91KB  |  3,607 lines

  1. /* Separate lexical analyzer for GNU C++.
  2.    Copyright (C) 1987 Free Software Foundation, Inc.
  3.    Hacked by Michael Tiemann (tiemann@mcc.com)
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. /* This file is the lexical analyzer for GNU C++.  */
  23.  
  24. #include <sys/types.h>
  25. #include <stdio.h>
  26. #include <errno.h>
  27. #include <setjmp.h>
  28. #include "config.h"
  29. #include "input.h"
  30. #include "tree.h"
  31. #ifdef VMS
  32. #define _IOFBF 2        /* Missing from GNU's stdio.h */
  33. #endif
  34. #include "cplus-tab.h"
  35. #include "cplus-parse.h"
  36. #include "cplus-tree.h"
  37. #include "flags.h"
  38. #include "obstack.h"
  39. #include "assert.h"
  40. extern int errno;        /* needed for VAX.  */
  41. extern jmp_buf toplevel;
  42.  
  43. #ifdef VMS
  44. #define    NULL_FILE    "nla0:"
  45. #else
  46. #define    NULL_FILE    "/dev/null"
  47. #endif
  48.  
  49. #define obstack_chunk_alloc xmalloc
  50. #define obstack_chunk_free free
  51.  
  52. extern int xmalloc ();
  53. extern void free ();
  54.  
  55. extern double atof ();
  56.  
  57. /* If you don't have strrchr, but instead have rindex,
  58.    add your machine to this list, and send mail to
  59.    tiemann@wheaties.ai.mit.edu.  */
  60. #if defined(sequent) || defined(convex)
  61. #define strrchr rindex
  62. #endif
  63. extern char *strrchr ();
  64.  
  65. /* This obstack is needed to hold text.  It is not safe to use
  66.    TOKEN_BUFFER because `check_newline' calls `yylex'.  */
  67. static struct obstack inline_text_obstack;
  68. static char *inline_text_firstobj;
  69.  
  70. /* Holds translations from TREE_CODEs to operator name strings,
  71.    i.e., opname_tab[PLUS_EXPR] == "+".  */
  72. char **opname_tab;
  73. char **assignop_tab;
  74.  
  75. #define YYEMPTY        -2
  76. int    yychar;            /*  the lookahead symbol        */
  77. YYSTYPE    yylval;            /*  the semantic value of the        */
  78.                 /*  lookahead symbol            */
  79.  
  80. #if 0
  81. YYLTYPE yylloc;            /*  location data for the lookahead    */
  82.                 /*  symbol                */
  83. #endif
  84.  
  85. int end_of_file;
  86.  
  87. /* the declaration found for the last IDENTIFIER token read in.
  88.    yylex must look this up to detect typedefs, which get token type TYPENAME,
  89.    so it is left around in case the identifier is not a typedef but is
  90.    used in a context which makes it a reference to a variable.  */
  91. tree lastiddecl;
  92.  
  93. /* C++ extensions */
  94. tree ridpointers[];        /* need this up here */
  95.  
  96. /* We may keep statistics about how long which files took to compile.  */
  97. static int header_time, body_time;
  98. static tree get_time_identifier ();
  99. static tree filename_times;
  100. static tree this_filename_time;
  101.  
  102. /* For implementing #pragma unit.  */
  103. tree current_unit_name;
  104. tree current_unit_language;
  105.  
  106. /* Array for holding counts of the numbers of tokens seen.  */
  107. int *token_count;
  108.  
  109. /* Return something to represent absolute declarators containing a *.
  110.    TARGET is the absolute declarator that the * contains.
  111.    TYPE_QUALS is a list of modifiers such as const or volatile
  112.    to apply to the pointer type, represented as identifiers.
  113.  
  114.    We return an INDIRECT_REF whose "contents" are TARGET
  115.    and whose type is the modifier list.  */
  116.  
  117. tree
  118. make_pointer_declarator (type_quals, target)
  119.      tree type_quals, target;
  120. {
  121.   if (target && TREE_CODE (target) == IDENTIFIER_NODE
  122.       && ANON_AGGRNAME_P (target))
  123.     error ("type name expected before `*'");
  124.   return build1 (INDIRECT_REF, type_quals, target);
  125. }
  126.  
  127. /* Return something to represent absolute declarators containing a &.
  128.    TARGET is the absolute declarator that the & contains.
  129.    TYPE_QUALS is a list of modifiers such as const or volatile
  130.    to apply to the reference type, represented as identifiers.
  131.  
  132.    We return an ADDR_EXPR whose "contents" are TARGET
  133.    and whose type is the modifier list.  */
  134.    
  135. tree
  136. make_reference_declarator (type_quals, target)
  137.      tree type_quals, target;
  138. {
  139.   if (target)
  140.     {
  141.       if (TREE_CODE (target) == ADDR_EXPR)
  142.     {
  143.       error ("cannot declare references to references");
  144.       return target;
  145.     }
  146.       if (TREE_CODE (target) == INDIRECT_REF)
  147.     {
  148.       error ("cannot declare pointers to references");
  149.       return target;
  150.     }
  151.       if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target))
  152.       error ("type name expected before `&'");
  153.     }
  154.   return build1 (ADDR_EXPR, type_quals, target);
  155. }
  156.  
  157. /* Given a chain of STRING_CST nodes,
  158.    concatenate them into one STRING_CST
  159.    and give it a suitable array-of-chars data type.  */
  160.  
  161. tree
  162. combine_strings (strings)
  163.      tree strings;
  164. {
  165.   register tree value, t;
  166.   register int length = 1;
  167.   int wide_length = 0;
  168.   int wide_flag = 0;
  169.  
  170.   if (TREE_CHAIN (strings))
  171.     {
  172.       /* More than one in the chain, so concatenate.  */
  173.       register char *p, *q;
  174.  
  175.       /* Don't include the \0 at the end of each substring,
  176.      except for the last one.
  177.      Count wide strings and ordinary strings separately.  */
  178.       for (t = strings; t; t = TREE_CHAIN (t))
  179.     {
  180.       if (TREE_TYPE (t) == int_array_type_node)
  181.         {
  182.           wide_length += (TREE_STRING_LENGTH (t) - 1);
  183.           wide_flag = 1;
  184.         }
  185.       else
  186.         length += (TREE_STRING_LENGTH (t) - 1);
  187.     }
  188.  
  189.       /* If anything is wide, the non-wides will be converted,
  190.      which makes them take more space.  */
  191.       if (wide_flag)
  192.     length = length * UNITS_PER_WORD + wide_length;
  193.  
  194.       p = (char *) savealloc (length);
  195.  
  196.       /* Copy the individual strings into the new combined string.
  197.      If the combined string is wide, convert the chars to ints
  198.      for any individual strings that are not wide.  */
  199.  
  200.       q = p;
  201.       for (t = strings; t; t = TREE_CHAIN (t))
  202.     {
  203.       int len = TREE_STRING_LENGTH (t) - 1;
  204.       if ((TREE_TYPE (t) == int_array_type_node) == wide_flag)
  205.         {
  206.           bcopy (TREE_STRING_POINTER (t), q, len);
  207.           q += len;
  208.         }
  209.       else
  210.         {
  211.           int i;
  212.           for (i = 0; i < len; i++)
  213.         ((int *) q)[i] = TREE_STRING_POINTER (t)[i];
  214.           q += len * UNITS_PER_WORD;
  215.         }
  216.     }
  217.       *q = 0;
  218.  
  219.       value = make_node (STRING_CST);
  220.       TREE_STRING_POINTER (value) = p;
  221.       TREE_STRING_LENGTH (value) = length;
  222.       TREE_LITERAL (value) = 1;
  223.     }
  224.   else
  225.     {
  226.       value = strings;
  227.       length = TREE_STRING_LENGTH (value);
  228.       if (TREE_TYPE (value) == int_array_type_node)
  229.     wide_flag = 1;
  230.     }
  231.  
  232.   /* Create the array type for the string constant.
  233.      -Wwrite-strings says make the string constant an array of const char
  234.      so that copying it to a non-const pointer will get a warning.  */
  235.   if (warn_write_strings)
  236.     {
  237.       tree elements
  238.     = build_type_variant (wide_flag ? integer_type_node : char_type_node,
  239.                   1, 0);
  240.       TREE_TYPE (value)
  241.     = build_array_type (elements,
  242.                 build_index_type (build_int_2 (length - 1, 0)));
  243.     }
  244.   else
  245.     TREE_TYPE (value)
  246.       = build_array_type (wide_flag ? integer_type_node : char_type_node,
  247.               build_index_type (build_int_2 (length - 1, 0)));
  248.   TREE_LITERAL (value) = 1;
  249.   TREE_STATIC (value) = 1;
  250.   return value;
  251. }
  252.  
  253. /* Build names and nodes for overloaded operators.  */
  254.  
  255. /* Memoized table for operator names.  */
  256. tree *node_table;
  257.  
  258. tree
  259. build_opid (code1, code2)
  260.      enum tree_code code1, code2;
  261. {
  262.   register tree t = make_node (OP_IDENTIFIER);
  263.   register tree tmp;
  264.   extern struct obstack *expression_obstack, permanent_obstack;
  265.   struct obstack *ambient_obstack = expression_obstack;
  266.   expression_obstack = &permanent_obstack;
  267.   if (code1 != 0)
  268.     {
  269.       if ((tmp = node_table[(int)code1]) == 0)
  270.     node_table[(int)code1] = tmp = make_node (code1);
  271.       TREE_PURPOSE (t) = tmp;
  272.     }
  273.   if ((tmp = node_table[(int)code2]) == 0)
  274.     node_table[(int)code2] = tmp = make_node (code2);
  275.   TREE_VALUE (t) = tmp;
  276.   expression_obstack = ambient_obstack;
  277.   return t;
  278. }
  279.  
  280. #ifdef __GNUC__
  281. #define DEFTREECODE(SYM, NAME, TYPE, LEN) sizeof (NAME),
  282. #else
  283. #define DEFTREECODE(SYM, NAME, TYPE, LEN) -1,
  284. #endif
  285. static short opname_end[] = {
  286. #include "tree.def"
  287. 7,                /* sizeof ("@@dummy"), */
  288. #include "cplus-tree.def"
  289. };
  290. #undef DEFTREECODE
  291.  
  292. /* Given a TOKEN and its estimated tree code CODE, produce a name which
  293.    can be recognized by lookup_name.  Based on the number of PARMS,
  294.    build an appropriate operator fnname.  This function is needed because
  295.    until we know how many parameters we have, we cannot reliably tell
  296.    what function indeed we are trying to declare.
  297.  
  298.    NPARMS is the number of additional parameters that this operator
  299.    will ultimately have.  If NPARMS == -1, then we are just building
  300.    a name, and should not complain.
  301.  
  302.    This would be a good candidate for memoizing.  */
  303. tree
  304. build_operator_fnname (declp, parms, nparms)
  305.      tree *declp;
  306.      tree parms;
  307.      int nparms;
  308. {
  309.   tree decl = *declp;
  310.   char **opname_table, *opname;
  311.   int assignop_p = 0;
  312.   tree rval;
  313.   enum tree_code code;
  314.   char buf[1024];
  315.   int saw_class = nparms;
  316.   int erred = 0;
  317.  
  318.   while (parms)
  319.     {
  320.       tree type;
  321.       if (parms == void_list_node)
  322.     break;
  323.  
  324.       if (! saw_class)
  325.     {
  326.       type = TREE_VALUE (parms);
  327.       if (TREE_CODE (type) == REFERENCE_TYPE)
  328.         type = TREE_TYPE (type);
  329.       if (TREE_CODE (type) == POINTER_TYPE)
  330.         type = TREE_TYPE (type);
  331.       if (IS_AGGR_TYPE (type))
  332.         saw_class = 1;
  333.     }
  334.       nparms++;
  335.       parms = TREE_CHAIN (parms);
  336.     }
  337.  
  338.   if (TREE_CODE (decl) == TYPE_EXPR)
  339.     {
  340.       /* @@ may need to perform type instantiation here.  */
  341.       if (nparms > 1)
  342.     error ("wrong number of arguments to type conversion operator");
  343.  
  344.       /* The grammar will swallow an "()" if one was given.
  345.      We attempt to correct for this lossage here.  */
  346.       if (TREE_OPERAND (decl, 0)
  347.       && TREE_CODE (TREE_OPERAND (decl, 0)) == CALL_EXPR)
  348.     {
  349.       rval = build_typename_overload (groktypename (build_tree_list (TREE_TYPE (decl), NULL_TREE)));
  350.       yychar = LEFT_RIGHT;
  351.     }
  352.       else
  353.     {
  354.       rval = build_typename_overload (groktypename (build_tree_list (TREE_TYPE (decl), TREE_OPERAND (decl, 0))));
  355.     }
  356.       return rval;
  357.     }
  358.  
  359.   if (TREE_PURPOSE (decl))
  360.     if (TREE_CODE (TREE_PURPOSE (decl)) == MODIFY_EXPR)
  361.       {
  362.     opname_table = assignop_tab;
  363.     assignop_p = 1;
  364.       }
  365.     else
  366.       abort ();
  367.   else
  368.     opname_table = opname_tab;
  369.  
  370.   code = TREE_CODE (TREE_VALUE (decl));
  371.   opname = opname_table[(int) code];
  372.  
  373.   if (assignop_p)
  374.     {
  375.       if (nparms == 1 || nparms > 2)
  376.     error ("wrong number of parameters op `operator %s'", opname);
  377.     }
  378.   else switch (code)
  379.     {
  380.     case ERROR_MARK:
  381.       rval = get_identifier ("<invalid operator>");
  382.       TREE_OVERLOADED (rval) = 1;
  383.       return rval;
  384.  
  385.       /* AC/DC */
  386.     case PLUS_EXPR:
  387.       if (nparms == 1)
  388.     code = CONVERT_EXPR;
  389.       else if (nparms != 2)
  390.     erred = 1;
  391.       break;
  392.  
  393.     case ADDR_EXPR:
  394.     case BIT_AND_EXPR:
  395.       if (nparms == 1)
  396.     code = ADDR_EXPR;
  397.       else if (nparms == 2)
  398.     code = BIT_AND_EXPR;
  399.       else
  400.     {
  401.       code = BIT_AND_EXPR;
  402.       erred = 1;
  403.     }
  404.       break;
  405.  
  406.     case MULT_EXPR:
  407.     case INDIRECT_REF:
  408.       if (nparms == 1)
  409.     code = INDIRECT_REF;
  410.       else if (nparms == 2)
  411.     code = MULT_EXPR;
  412.       else
  413.     {
  414.       code = MULT_EXPR;
  415.       erred = 1;
  416.     }
  417.       break;
  418.  
  419.     case MINUS_EXPR:
  420.     case NEGATE_EXPR:
  421.       if (nparms == 1)
  422.     code = NEGATE_EXPR;
  423.       else if (nparms == 2)
  424.     code = MINUS_EXPR;
  425.       else
  426.     {
  427.       code = MINUS_EXPR;
  428.       erred = 1;
  429.     }
  430.       break;
  431.  
  432.     case POINTSAT:
  433.       if (nparms == 1 || nparms < 0)
  434.     code = COMPONENT_REF;
  435.       else
  436.     {
  437.       erred = -1;
  438.       error ("wrong number of parameters to `operator ->()'");
  439.     }
  440.       break;
  441.  
  442.     case METHOD_CALL_EXPR:
  443.       switch (nparms)
  444.     {
  445.     case 0:
  446.     case 1:
  447.       erred = -1;
  448.       error ("too few arguments to `operator ->()(...)'");
  449.       break;
  450.       /* 4 happens when we pass in the canonical number
  451.          of arguments.  */
  452.     case 4:
  453.       nparms = 3;
  454.     case -1:
  455.     case 2:
  456.     case 3:
  457.       break;
  458.     default:
  459.       erred = -1;
  460.       error ("too many arguments to `operator ->()(...)'");
  461.       break;
  462.     }
  463.       break;
  464.  
  465.       /* The two following entrys are for two different ways of
  466.      encoding `operator ='.  */
  467.     case NOP_EXPR:
  468.       if (nparms != 2 && nparms >= 0)
  469.     erred = 1;
  470.       break;
  471.  
  472.     case MODIFY_EXPR:
  473.       if (nparms != 2 && nparms >= 0)
  474.     erred = 1;
  475.       break;
  476.  
  477.     case NEW_EXPR:
  478.       if (saw_class == 0)
  479.     {
  480.       if (nparms > 1)
  481.         return get_identifier ("__user_new");
  482.       return get_identifier ("__builtin_new");
  483.     }
  484.       break;
  485.  
  486.     case DELETE_EXPR:
  487.       if (saw_class == 0)
  488.     {
  489.       if (nparms > 1)
  490.         error ("too many parameters to `operator ::delete'");
  491.       return get_identifier ("__builtin_delete");
  492.     }
  493.       if (nparms > 2)
  494.     erred = 1;
  495.       break;
  496.  
  497.       /* Whatever it was, we know its arity.  Just check that it
  498.          has the right number of parameters defined.  */
  499.     default:
  500.       /* These are the only operators which do not need
  501.      to have a class-type associated with them.  */
  502.  
  503.       if (code == PREDECREMENT_EXPR
  504.       || code == POSTINCREMENT_EXPR
  505.       || code == COMPONENT_REF)
  506.     {
  507.       if (nparms > 1)
  508.         erred = 1;
  509.     }
  510.       else if (nparms < 0
  511.            || code == CALL_EXPR
  512.            || code == METHOD_CALL_EXPR)
  513.     ;
  514.       else if (nparms != tree_code_length [(int) code])
  515.     erred = 1;
  516.       break;
  517.     }
  518.  
  519.   if (erred > 0)
  520.     error ("wrong number of parameters to `operator %s'", opname);
  521.   else if (erred == 0 && code != TREE_CODE (TREE_VALUE (decl)))
  522.     {
  523.       enum tree_code assign_code = ERROR_MARK;
  524.       if (TREE_PURPOSE (decl))
  525.     assign_code = TREE_CODE (TREE_PURPOSE (decl));
  526.       decl = build_opid (assign_code, code);
  527.       *declp = decl;
  528.     }
  529.  
  530.   if (! saw_class)
  531.     error ("`operator %s' must have at least one class type", opname);
  532.  
  533.   if (assignop_p)
  534.     {
  535.       sprintf (buf, OPERATOR_ASSIGN_FORMAT, tree_code_name [(int) code]);
  536.       buf[opname_end[(int) code] + sizeof (OPERATOR_ASSIGN_FORMAT) - 3] = '\0';
  537.     }
  538.   else
  539.     {
  540.       sprintf (buf, OPERATOR_FORMAT, tree_code_name [(int) code]);
  541.       buf[opname_end[(int) code] + sizeof (OPERATOR_FORMAT) - 3] = '\0';
  542.     }      
  543.   rval = get_identifier (buf);
  544.   TREE_OVERLOADED (rval) = 1;
  545.   return rval;
  546. }
  547.  
  548. char *
  549. operator_name_string (name)
  550.      tree name;
  551. {
  552.   char *opname = IDENTIFIER_POINTER (name)
  553.     + sizeof (OPERATOR_FORMAT) - sizeof ("%s");
  554.   int i, assign;
  555.  
  556.   /* Works for builtin and user defined types.  */
  557.   if (IDENTIFIER_GLOBAL_VALUE (name)
  558.       && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (name)) == TYPE_DECL)
  559.     return IDENTIFIER_POINTER (name);
  560.  
  561.   if (! strncmp (opname, "assign", 6))
  562.     {
  563.       opname += 7;
  564.       assign = 1;
  565.     }
  566.   else
  567.     assign = 0;
  568.  
  569.   for (i = 0; i < LAST_CPLUS_TREE_CODE; i++)
  570.     {
  571.       if (! strncmp (opname, tree_code_name[i], opname_end[i]))
  572.     break;
  573.     }
  574.  
  575.   assert (i != LAST_CPLUS_TREE_CODE);
  576.  
  577.   if (assign)
  578.     return assignop_tab[i];
  579.   else
  580.     return opname_tab[i];
  581. }
  582.  
  583. int lineno;            /* current line number in file being read */
  584.  
  585. FILE *finput;            /* input file.
  586.                    Normally a pipe from the preprocessor.  */
  587. static FILE *finput1;        /* Real input files: 1 is main input file */
  588. static FILE *finput2;        /* 2 is input file for inline functions */
  589.  
  590. /* lexical analyzer */
  591.  
  592. static int maxtoken;        /* Current nominal length of token buffer.  */
  593. char *token_buffer;        /* Pointer to token buffer.
  594.                    Actual allocated length is maxtoken + 2.  */
  595. static int max_wide;        /* Current nominal length of wide_buffer.  */
  596. static int *wide_buffer;    /* Pointer to wide-string buffer.
  597.                    Actual allocated length is max_wide + 1.  */
  598.  
  599. #define NORID RID_UNUSED
  600.  
  601. /* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$ gplus.gperf  */
  602. struct resword { char *name; short token; enum rid rid;};
  603.  
  604. #define MIN_WORD_LENGTH 2
  605. #define MAX_WORD_LENGTH 13
  606. #define MIN_HASH_VALUE 4
  607. #define MAX_HASH_VALUE 147
  608. /*
  609.    71 keywords
  610.   144 is the maximum key range
  611. */
  612.  
  613. #ifdef __GNUC__
  614. inline
  615. #endif
  616. static int
  617. hash (str, len)
  618.      register char *str;
  619.      register int unsigned len;
  620. {
  621.   static unsigned char hash_table[] =
  622.     {
  623.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  624.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  625.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  626.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  627.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  628.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  629.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  630.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  631.      147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
  632.      147, 147, 147, 147, 147,   0, 147,  19,   6,  27,
  633.       37,   0,  12,   1,  15,  63, 147,   4,   0,  56,
  634.       20,  15,  42, 147,  31,   5,  26,  39,  32,  10,
  635.      147,  40, 147, 147, 147, 147, 147, 147,
  636.     };
  637.   register int hval = len ;
  638.  
  639.   switch (hval)
  640.     {
  641.       default:
  642.       case 4:
  643.         hval += hash_table[str[3]];
  644.       case 3:
  645.       case 2:
  646.       case 1:
  647.         hval += hash_table[str[0]];
  648.     }
  649.   return hval + hash_table[str[len - 1]] ;
  650. }
  651.  
  652. #ifdef __GNUC__
  653. inline
  654. #endif
  655. struct resword *
  656. is_reserved_word (str, len)
  657.      register char *str;
  658.      register unsigned int len;
  659. {
  660.  
  661.   static struct resword  wordlist[] =
  662.     {
  663.       {"",}, {"",}, {"",}, {"",}, 
  664.       {"else",  ELSE, NORID,},
  665.       {"",}, 
  666.       {"long",  TYPESPEC, RID_LONG,},
  667.       {"",}, {"",}, {"",}, {"",}, 
  668.       {"__alignof__",  ALIGNOF, NORID},
  669.       {"__asm__",  ASM, NORID},
  670.       {"",}, {"",}, 
  671.       {"while",  WHILE, NORID,},
  672.       {"",}, {"",}, {"",}, {"",}, {"",}, 
  673.       {"__alignof",  ALIGNOF, NORID},
  674.       {"all",  ALL, NORID            /* Extension */,},
  675.       {"sizeof",  SIZEOF, NORID,},
  676.       {"__const__",  TYPE_QUAL, RID_CONST},
  677.       {"__volatile",  TYPE_QUAL, RID_VOLATILE},
  678.       {"extern",  SCSPEC, RID_EXTERN,},
  679.       {"__volatile__",  TYPE_QUAL, RID_VOLATILE},
  680.       {"__inline",  SCSPEC, RID_INLINE},
  681.       {"exception",  AGGR, RID_EXCEPTION    /* Extension */,},
  682.       {"__inline__",  SCSPEC, RID_INLINE},
  683.       {"case",  CASE, NORID,},
  684.       {"except",  EXCEPT, NORID        /* Extension */,},
  685.       {"new",  NEW, NORID,},
  686.       {"break",  BREAK, NORID,},
  687.       {"goto",  GOTO, NORID,},
  688.       {"",}, 
  689.       {"__attribute",  ATTRIBUTE, NORID},
  690.       {"",}, 
  691.       {"__attribute__",  ATTRIBUTE, NORID},
  692.       {"this",  THIS, NORID,},
  693.       {"raise",  RAISE, NORID        /* Extension */,},
  694.       {"class",  AGGR, RID_CLASS,},
  695.       {"delete",  DELETE, NORID,},
  696.       {"typeof",  TYPEOF, NORID,},
  697.       {"typedef",  SCSPEC, RID_TYPEDEF,},
  698.       {"for",  FOR, NORID,},
  699.       {"raises",  RAISES, NORID        /* Extension */,},
  700.       {"__const",  TYPE_QUAL, RID_CONST},
  701.       {"double",  TYPESPEC, RID_DOUBLE,},
  702.       {"__typeof__",  TYPEOF, NORID},
  703.       {"",}, 
  704.       {"switch",  SWITCH, NORID,},
  705.       {"auto",  SCSPEC, RID_AUTO,},
  706.       {"do",  DO, NORID,},
  707.       {"friend",  SCSPEC, RID_FRIEND,},
  708.       {"",}, 
  709.       {"reraise",  RERAISE, NORID        /* Extension */,},
  710.       {"",}, 
  711.       {"volatile",  TYPE_QUAL, RID_VOLATILE,},
  712.       {"__typeof",  TYPEOF, NORID},
  713.       {"continue",  CONTINUE, NORID,},
  714.       {"float",  TYPESPEC, RID_FLOAT,},
  715.       {"const",  TYPE_QUAL, RID_CONST,},
  716.       {"static",  SCSPEC, RID_STATIC,},
  717.       {"virtual",  SCSPEC, RID_VIRTUAL,},
  718.       {"__asm",  ASM, NORID},
  719.       {"short",  TYPESPEC, RID_SHORT,},
  720.       {"signed",  TYPESPEC, RID_SIGNED,},
  721.       {"try",  TRY, NORID            /* Extension */,},
  722.       {"",}, {"",}, {"",}, 
  723.       {"__signed__",  TYPESPEC, RID_SIGNED},
  724.       {"catch",  CATCH, NORID,},
  725.       {"public",  PUBLIC, NORID,},
  726.       {"struct",  AGGR, RID_RECORD,},
  727.       {"if",  IF, NORID,},
  728.       {"asm",  ASM, NORID,},
  729.       {"union",  AGGR, RID_UNION,},
  730.       {"",}, 
  731.       {"private",  PRIVATE, NORID,},
  732.       {"",}, {"",}, {"",}, 
  733.       {"operator",  OPERATOR, NORID,},
  734.       {"",}, {"",}, {"",}, 
  735.       {"default",  DEFAULT, NORID,},
  736.       {"dynamic",  DYNAMIC, NORID,},
  737.       {"overload",  OVERLOAD, NORID,},
  738.       {"int",  TYPESPEC, RID_INT,},
  739.       {"char",  TYPESPEC, RID_CHAR,},
  740.       {"",}, {"",}, 
  741.       {"return",  RETURN, NORID,},
  742.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  743.       {"",}, {"",}, 
  744.       {"__signed",  TYPESPEC, RID_SIGNED},
  745.       {"",}, 
  746.       {"void",  TYPESPEC, RID_VOID,},
  747.       {"",}, {"",}, {"",}, 
  748.       {"protected",  PROTECTED, NORID,},
  749.       {"",}, 
  750.       {"enum",  ENUM, NORID,},
  751.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  752.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  753.       {"inline",  SCSPEC, RID_INLINE,},
  754.       {"register",  SCSPEC, RID_REGISTER,},
  755.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  756.       {"",}, {"",}, {"",}, {"",}, 
  757.       {"unsigned",  TYPESPEC, RID_UNSIGNED,},
  758.     };
  759.  
  760.   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
  761.     {
  762.       register int key = hash (str, len);
  763.  
  764.       if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
  765.         {
  766.           register char *s = wordlist[key].name;
  767.  
  768.           if (*s == *str && !strcmp (str + 1, s + 1))
  769.             return &wordlist[key];
  770.         }
  771.     }
  772.   return 0;
  773. }
  774.  
  775. /* The elements of `ridpointers' are identifier nodes
  776.    for the reserved type names and storage classes.
  777.    It is indexed by a RID_... value.  */
  778.  
  779. tree ridpointers[(int) RID_MAX];
  780.  
  781. int check_newline ();
  782.  
  783. static int skip_white_space ();
  784.  
  785. static tree get_time_identifier (name)
  786.      char *name;
  787. {
  788.   tree time_identifier;
  789.   int len = strlen (name);
  790.   char *buf = (char *)alloca (len + 6);
  791.   strcpy (buf, "file ");
  792.   bcopy (name, buf+5, len);
  793.   buf[len+5] = '\0';
  794.   time_identifier = get_identifier (buf);
  795.   if (IDENTIFIER_LOCAL_VALUE (time_identifier) == NULL_TREE)
  796.     {
  797.       int temp = allocation_temporary_p ();
  798.       if (temp)
  799.     end_temporary_allocation ();
  800.       IDENTIFIER_LOCAL_VALUE (time_identifier) = build_int_2 (0, 0);
  801.       IDENTIFIER_GLOBAL_VALUE (time_identifier) = filename_times;
  802.       filename_times = time_identifier;
  803.       if (temp)
  804.     resume_temporary_allocation ();
  805.     }
  806.   return time_identifier;
  807. }
  808.  
  809. #ifdef __GNUC__
  810. __inline
  811. #endif
  812. static int
  813. my_gettime ()
  814. {
  815.   int old_quiet_flag = quiet_flag;
  816.   int this_time;
  817.   quiet_flag = 0;
  818.   this_time = gettime ();
  819.   quiet_flag = old_quiet_flag;
  820.   return this_time;
  821. }
  822.  
  823. /* Table indexed by tree code giving a string containing a character
  824.    classifying the tree code.  Possibilities are
  825.    t, d, s, c, r and e.  See cplus-tree.def for details.  */
  826.  
  827. #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
  828.  
  829. char *cplus_tree_code_type[] = {
  830.   "x",
  831. #include "cplus-tree.def"
  832. };
  833. #undef DEFTREECODE
  834.  
  835. /* Table indexed by tree code giving number of expression
  836.    operands beyond the fixed part of the node structure.
  837.    Not used for types or decls.  */
  838.  
  839. #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
  840.  
  841. int cplus_tree_code_length[] = {
  842.   0,
  843. #include "cplus-tree.def"
  844. };
  845. #undef DEFTREECODE
  846.  
  847. /* Names of tree components.
  848.    Used for printing out the tree and error messages.  */
  849. #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
  850.  
  851. char *cplus_tree_code_name[] = {
  852.   "@@dummy",
  853. #include "cplus-tree.def"
  854. };
  855. #undef DEFTREECODE
  856.  
  857. /* Change by Bryan Boreham, Kewill, Thu Jul 27 09:46:05 1989.
  858.    Stuck this hack in to get the files open correctly; this is called
  859.    in place of init_lex if we are an unexec'd binary.    */
  860. void
  861. reinit_lex_for_unexec ()
  862. {
  863.   finput1 = finput;
  864.   finput2 = fopen (NULL_FILE, "r");
  865. }
  866.  
  867. void
  868. init_lex ()
  869. {
  870.   extern int *init_parse ();
  871.   extern char *(*decl_printable_name) ();
  872.   extern char *lang_printable_name ();
  873.   extern struct rtx_def *(*lang_expand_expr) ();
  874.   extern struct rtx_def *cplus_expand_expr ();
  875.  
  876.   int i;
  877.  
  878.   /* Make identifier nodes long enough for the language-specific slots.  */
  879.   set_identifier_size (sizeof (struct lang_identifier));
  880.   decl_printable_name = lang_printable_name;
  881.   lang_expand_expr = cplus_expand_expr;
  882.  
  883.   tree_code_type
  884.     = (char **) realloc (tree_code_type,
  885.              sizeof (char *) * LAST_CPLUS_TREE_CODE);
  886.   tree_code_length
  887.     = (int *) realloc (tree_code_length,
  888.                sizeof (int) * LAST_CPLUS_TREE_CODE);
  889.   tree_code_name
  890.     = (char **) realloc (tree_code_name,
  891.              sizeof (char *) * LAST_CPLUS_TREE_CODE);
  892.   bcopy (cplus_tree_code_type,
  893.      tree_code_type + LAST_AND_UNUSED_TREE_CODE,
  894.      (LAST_CPLUS_TREE_CODE - LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
  895.   bcopy (cplus_tree_code_length,
  896.      tree_code_length + LAST_AND_UNUSED_TREE_CODE,
  897.      (LAST_CPLUS_TREE_CODE - LAST_AND_UNUSED_TREE_CODE) * sizeof (int));
  898.   bcopy (cplus_tree_code_name,
  899.      tree_code_name + LAST_AND_UNUSED_TREE_CODE,
  900.      (LAST_CPLUS_TREE_CODE - LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
  901.  
  902.   node_table = (tree *)oballoc (LAST_CPLUS_TREE_CODE * sizeof (tree));
  903.   opname_tab = (char **)oballoc (LAST_CPLUS_TREE_CODE * sizeof (char *));
  904.   assignop_tab = (char **)oballoc (LAST_CPLUS_TREE_CODE * sizeof (char *));
  905.  
  906.   for (i = 0; i < LAST_CPLUS_TREE_CODE; i++)
  907.     /* Our only interest is _ref and _expr.  */
  908.     if (tree_code_type[i][0] == 'r' || tree_code_type[i][0] == 'e')
  909.       {
  910.     char *end = (char *)strrchr (tree_code_name[i], '_');
  911.     if (end)
  912.       opname_end[i] = end - tree_code_name[i];
  913. #ifndef __GNUC__
  914.     else
  915.       opname_end[i] = strlen (tree_code_name[i]);
  916. #endif
  917.       }
  918. #ifndef __GNUC__
  919.     else
  920.       opname_end[i] = strlen (tree_code_name[i]);
  921. #endif
  922.  
  923.   init_method ();
  924.   obstack_init (&inline_text_obstack);
  925.   inline_text_firstobj = (char *) obstack_alloc (&inline_text_obstack, 0);
  926.  
  927.   /* Start it at 0, because check_newline is called at the very beginning
  928.      and will increment it to 1.  */
  929.   lineno = 0;
  930.   finput1 = finput;
  931.   finput2 = fopen (NULL_FILE, "r");
  932.   current_function_decl = NULL;
  933.  
  934.   maxtoken = 40;
  935.   token_buffer = (char *) xmalloc (maxtoken + 2);
  936.   max_wide = 40;
  937.   wide_buffer = (int *) xmalloc (max_wide + 1);
  938.  
  939.   ridpointers[(int) RID_INT] = get_identifier ("int");
  940.   ridpointers[(int) RID_CHAR] = get_identifier ("char");
  941.   ridpointers[(int) RID_VOID] = get_identifier ("void");
  942.   ridpointers[(int) RID_FLOAT] = get_identifier ("float");
  943.   ridpointers[(int) RID_DOUBLE] = get_identifier ("double");
  944.   ridpointers[(int) RID_SHORT] = get_identifier ("short");
  945.   ridpointers[(int) RID_LONG] = get_identifier ("long");
  946.   ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned");
  947.   ridpointers[(int) RID_SIGNED] = get_identifier ("signed");
  948.   ridpointers[(int) RID_INLINE] = get_identifier ("inline");
  949.   ridpointers[(int) RID_CONST] = get_identifier ("const");
  950.   ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
  951.   ridpointers[(int) RID_AUTO] = get_identifier ("auto");
  952.   ridpointers[(int) RID_STATIC] = get_identifier ("static");
  953.   ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
  954.   ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef");
  955.   ridpointers[(int) RID_REGISTER] = get_identifier ("register");
  956.  
  957.   /* C++ extensions. These are probably not correctly named. */
  958.   class_type_node = build_int_2 (class_type, 0);
  959.   TREE_TYPE (class_type_node) = class_type_node;
  960.   ridpointers[(int) RID_CLASS] = class_type_node;
  961.  
  962.   record_type_node = build_int_2 (record_type, 0);
  963.   TREE_TYPE (record_type_node) = record_type_node;
  964.   ridpointers[(int) RID_RECORD] = record_type_node;
  965.  
  966.   union_type_node = build_int_2 (union_type, 0);
  967.   TREE_TYPE (union_type_node) = union_type_node;
  968.   ridpointers[(int) RID_UNION] = union_type_node;
  969.  
  970.   enum_type_node = build_int_2 (enum_type, 0);
  971.   TREE_TYPE (enum_type_node) = enum_type_node;
  972.   ridpointers[(int) RID_ENUM] = enum_type_node;
  973.  
  974.   ridpointers[(int) RID_VIRTUAL] = get_identifier ("virtual");
  975.   ridpointers[(int) RID_FRIEND] = get_identifier ("friend");
  976.  
  977.   /* Exception handling extensions.  */
  978.   exception_type_node = build_int_2 (exception_type, 0);
  979.   TREE_TYPE (exception_type_node) = exception_type_node;
  980.   ridpointers[(int) RID_EXCEPTION] = exception_type_node;
  981.  
  982.   opname_tab[(int) COMPONENT_REF] = "->";
  983.   opname_tab[(int) METHOD_CALL_EXPR] = "->()";
  984.   opname_tab[(int) INDIRECT_REF] = "(unary *)";
  985.   opname_tab[(int) ARRAY_REF] = "[]";
  986.   opname_tab[(int) MODIFY_EXPR] = "=";
  987.   opname_tab[(int) NEW_EXPR] = "new";
  988.   opname_tab[(int) DELETE_EXPR] = "delete";
  989.   opname_tab[(int) COND_EXPR] = "... ? ... : ...";
  990.   opname_tab[(int) CALL_EXPR] = "()";
  991.   opname_tab[(int) PLUS_EXPR] = "+";
  992.   opname_tab[(int) MINUS_EXPR] = "-";
  993.   opname_tab[(int) MULT_EXPR] = "*";
  994.   opname_tab[(int) TRUNC_DIV_EXPR] = "/";
  995.   opname_tab[(int) CEIL_DIV_EXPR] = "(ceiling /)";
  996.   opname_tab[(int) FLOOR_DIV_EXPR] = "(floor /)";
  997.   opname_tab[(int) ROUND_DIV_EXPR] = "(round /)";
  998.   opname_tab[(int) TRUNC_MOD_EXPR] = "%";
  999.   opname_tab[(int) CEIL_MOD_EXPR] = "(ceiling %)";
  1000.   opname_tab[(int) FLOOR_MOD_EXPR] = "(floor %)";
  1001.   opname_tab[(int) ROUND_MOD_EXPR] = "(round %)";
  1002.   opname_tab[(int) NEGATE_EXPR] = "-";
  1003.   opname_tab[(int) MIN_EXPR] = "<?";
  1004.   opname_tab[(int) MAX_EXPR] = ">?";
  1005.   opname_tab[(int) ABS_EXPR] = "abs";
  1006.   opname_tab[(int) FFS_EXPR] = "ffs";
  1007.   opname_tab[(int) LSHIFT_EXPR] = "<<";
  1008.   opname_tab[(int) RSHIFT_EXPR] = ">>";
  1009.   opname_tab[(int) BIT_IOR_EXPR] = "|";
  1010.   opname_tab[(int) BIT_XOR_EXPR] = "^";
  1011.   opname_tab[(int) BIT_AND_EXPR] = "&";
  1012.   opname_tab[(int) BIT_ANDTC_EXPR] = "&~";
  1013.   opname_tab[(int) BIT_NOT_EXPR] = "~";
  1014.   opname_tab[(int) TRUTH_ANDIF_EXPR] = "&&";
  1015.   opname_tab[(int) TRUTH_ORIF_EXPR] = "||";
  1016.   opname_tab[(int) TRUTH_AND_EXPR] = "strict &&";
  1017.   opname_tab[(int) TRUTH_OR_EXPR] = "strict ||";
  1018.   opname_tab[(int) TRUTH_NOT_EXPR] = "!";
  1019.   opname_tab[(int) LT_EXPR] = "<";
  1020.   opname_tab[(int) LE_EXPR] = "<=";
  1021.   opname_tab[(int) GT_EXPR] = ">";
  1022.   opname_tab[(int) GE_EXPR] = ">=";
  1023.   opname_tab[(int) EQ_EXPR] = "==";
  1024.   opname_tab[(int) NE_EXPR] = "!=";
  1025.   opname_tab[(int) IN_EXPR] = "in";
  1026.   opname_tab[(int) SET_LE_EXPR] = "subset";
  1027.   opname_tab[(int) CARD_EXPR] = "#";
  1028.   opname_tab[(int) RANGE_EXPR] = "..";
  1029.   opname_tab[(int) CONVERT_EXPR] = "(unary +)";
  1030.   opname_tab[(int) ADDR_EXPR] = "(unary &)";
  1031.   opname_tab[(int) PREDECREMENT_EXPR] = "--";
  1032.   opname_tab[(int) PREINCREMENT_EXPR] = "++";
  1033.   opname_tab[(int) POSTDECREMENT_EXPR] = "--";
  1034.   opname_tab[(int) POSTINCREMENT_EXPR] = "++";
  1035.   assignop_tab[(int) NOP_EXPR] = "=";
  1036.   assignop_tab[(int) PLUS_EXPR] =  "+=";
  1037.   assignop_tab[(int) MINUS_EXPR] = "-=";
  1038.   assignop_tab[(int) MULT_EXPR] = "*=";
  1039.   assignop_tab[(int) TRUNC_DIV_EXPR] = "/=";
  1040.   assignop_tab[(int) CEIL_DIV_EXPR] = "(ceiling /=)";
  1041.   assignop_tab[(int) FLOOR_DIV_EXPR] = "(floor /=)";
  1042.   assignop_tab[(int) ROUND_DIV_EXPR] = "(round /=)";
  1043.   assignop_tab[(int) TRUNC_MOD_EXPR] = "%=";
  1044.   assignop_tab[(int) CEIL_MOD_EXPR] = "(ceiling %=)";
  1045.   assignop_tab[(int) FLOOR_MOD_EXPR] = "(floor %=)";
  1046.   assignop_tab[(int) ROUND_MOD_EXPR] = "(round %=)";
  1047.   assignop_tab[(int) MIN_EXPR] = "<?=";
  1048.   assignop_tab[(int) MAX_EXPR] = ">?=";
  1049.   assignop_tab[(int) LSHIFT_EXPR] = "<<=";
  1050.   assignop_tab[(int) RSHIFT_EXPR] = ">>=";
  1051.   assignop_tab[(int) BIT_IOR_EXPR] = "|=";
  1052.   assignop_tab[(int) BIT_XOR_EXPR] = "^=";
  1053.   assignop_tab[(int) BIT_AND_EXPR] = "&=";
  1054.  
  1055.   if (flag_detailed_statistics)
  1056.     {
  1057.       this_filename_time = get_time_identifier ("<top level>");
  1058.       header_time = 0;
  1059.       body_time = my_gettime ();
  1060.       TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (this_filename_time)) = body_time;
  1061.     }
  1062. #define UNSET_RESERVED_WORD(STRING) \
  1063.   do { is_reserved_word (STRING, sizeof (STRING) - 1)->name = ""; } while (0)
  1064.  
  1065.   if (! flag_handle_exceptions)
  1066.     {
  1067.       /* Easiest way to not reconize exception
  1068.      handling extenions...  */
  1069.       UNSET_RESERVED_WORD ("all");
  1070.       UNSET_RESERVED_WORD ("except");
  1071.       UNSET_RESERVED_WORD ("exception");
  1072.       UNSET_RESERVED_WORD ("raise");
  1073.       UNSET_RESERVED_WORD ("raises");
  1074.       UNSET_RESERVED_WORD ("reraise");
  1075.       UNSET_RESERVED_WORD ("try");
  1076.     }
  1077.   if (flag_no_asm)
  1078.     UNSET_RESERVED_WORD ("asm");
  1079.   if (flag_no_asm || flag_traditional)
  1080.     UNSET_RESERVED_WORD ("typeof");
  1081.   token_count = init_parse ();
  1082. }
  1083.  
  1084. void
  1085. reinit_parse_for_function ()
  1086. {
  1087.   current_base_init_list = NULL_TREE;
  1088.   current_member_init_list = NULL_TREE;
  1089. }
  1090.  
  1091. /* Called from the top level: if there are any pending inlines to
  1092.    do, set up to process them now.  */
  1093. void
  1094. do_pending_inlines ()
  1095. {
  1096.   if (finput == finput1)
  1097.     {
  1098.       struct pending_inline *prev = 0, *tail;
  1099.       struct pending_inline *t =
  1100.     (struct pending_inline *) obstack_alloc (&inline_text_obstack,
  1101.                          sizeof (struct pending_inline));
  1102.  
  1103.       /* Record state we were in when we decided to process
  1104.      inline functions instead.  */
  1105.       t->next = pending_inlines;
  1106.       pending_inlines = t;
  1107.       t->lineno = lineno;
  1108.       t->filename = input_filename;
  1109.       t->fndecl = NULL_TREE;
  1110.       t->token = yychar;
  1111.       t->token_value = yylval.itype;
  1112.  
  1113.       /* Reverse the pending inline functions, since
  1114.      they were cons'd instead of appended.  */
  1115.  
  1116.       for (; t; t = tail)
  1117.     {
  1118.       tail = t->next;
  1119.       t->next = prev;
  1120.       prev = t;
  1121.     }
  1122.       pending_inlines = prev;
  1123.  
  1124.       /* Now start processing the first inline function.  */
  1125.       t = pending_inlines;
  1126.       pending_inlines = pending_inlines->next;
  1127.       finput = finput2;
  1128. #if defined(i386) && !defined(sequent) && !defined(sun386)
  1129.       finput2->_ptr = finput2->_base = t->buf;
  1130.       _bufend(finput2) = t->buf + t->len;
  1131.       finput2->_flag = _IOFBF | _IOREAD;
  1132.       finput2->_cnt = t->len - 1;
  1133. #else
  1134. #ifndef hp9000s300
  1135. #ifdef USG_STDIO
  1136.       setvbuf(finput2,t->buf,_IOFBF,t->len);
  1137.       finput2->_cnt = t->len-1;
  1138. #else
  1139. #ifdef VMS
  1140.       setvbuf(finput2,t->buf,_IOFBF,t->len);
  1141.       (*finput2)->_cnt = t->len-1;
  1142. #else
  1143. #ifdef sprite
  1144.       setvbuf(finput2, t->buf, t->len);
  1145.       finput->readCount = t->len-1;
  1146. #else      
  1147.       setbuffer (finput2, t->buf, t->len);
  1148.       finput2->_cnt = finput2->_bufsiz - 1;
  1149. #endif                          /* sprite */
  1150. #endif                /* VMS */
  1151. #endif                /* USG_STDIO */
  1152. #else
  1153.       setvbuf(finput2,t->buf,_IOFBF,t->len);
  1154.       finput2->_cnt = t->len-1;
  1155. #endif
  1156. #endif
  1157.       lineno = t->lineno;
  1158.       input_filename = t->filename;
  1159.       yychar = PRE_PARSED_FUNCTION_DECL;
  1160.       yylval.ttype = t->fndecl;
  1161.       if (flag_default_inline)
  1162.     TREE_INLINE (t->fndecl) = 1;
  1163.     }
  1164. }
  1165.  
  1166. /* Since inline methods can refer to text which has not yet been seen,
  1167.    we store the text of the method in a structure which is placed in the
  1168.    DECL_PENDING_INLINE_INFO field of the FUNCTION_DECL.
  1169.    After parsing the body of the class definition, the FUNCTION_DECL's are
  1170.    scanned to see which ones have this field set.  Those are then digested
  1171.    one at a time.
  1172.  
  1173.    This function's FUNCTION_DECL will have a bit set in its common so
  1174.    that we know to watch out for it.  */
  1175.  
  1176. void
  1177. consume_string (this_obstack)
  1178.      register struct obstack *this_obstack;
  1179. {
  1180.   register char c;
  1181.   do
  1182.     {
  1183.       c = getc (finput);
  1184.       if (c == '\\')
  1185.     {
  1186.       obstack_1grow (this_obstack, c);
  1187.       c = getc (finput);
  1188.       obstack_1grow (this_obstack, c);
  1189.       continue;
  1190.     }
  1191.       if (c == '\n')
  1192.     {
  1193.       if (pedantic)
  1194.         warning ("ANSI C forbids newline in string constant");
  1195.       lineno++;
  1196.     }
  1197.       obstack_1grow (this_obstack, c);
  1198.     }
  1199.   while (c != '\"');
  1200. }
  1201.  
  1202. static int nextchar = -1;
  1203. static int nextyychar = -1;
  1204. static YYSTYPE nextyylval;
  1205. static tree nextlastiddecl;
  1206.  
  1207. /* Return next non-whitespace input character, which may come
  1208.    from `finput', or from `nextchar'.  */
  1209. static int
  1210. yynextch ()
  1211. {
  1212.   int c;
  1213.  
  1214.   if (nextchar >= 0)
  1215.     {
  1216.       c = nextchar;
  1217.       nextchar = -1;
  1218.     }
  1219.   else c = getc (finput);
  1220.   return skip_white_space (c);
  1221. }
  1222.  
  1223. static int
  1224. getch ()
  1225. {
  1226.   return getc (finput);
  1227. }
  1228.  
  1229. /* Unget character CH from the input stream.
  1230.    If RESCAN is non-zero, then we want to `see' this
  1231.    character as the next input token.  */
  1232. void
  1233. yyungetc (ch, rescan)
  1234.      int ch;
  1235.      int rescan;
  1236. {
  1237.   /* Unget a characater from the input stream.  */
  1238.   if (yychar == YYEMPTY || rescan == 0)
  1239.     ungetc (ch, finput);
  1240.   else
  1241.     {
  1242.       if (nextyychar >= 0)
  1243.     abort ();
  1244.       nextyychar = yychar;
  1245.       nextyylval = yylval;
  1246.       yychar = ch;
  1247.     }
  1248. }
  1249.  
  1250. void
  1251. reinit_parse_for_method (yychar, decl)
  1252.      int yychar;
  1253.      tree decl;
  1254. {
  1255.   register char c = 0;
  1256.   int blev = 1;
  1257.   tree fndecl = decl;
  1258.   int starting_lineno;
  1259.   int len;
  1260.  
  1261.   starting_lineno = lineno;
  1262.   if (yychar != '{')
  1263.     {
  1264.       if (yychar != ':' && yychar != RETURN)
  1265.     yychar = '{';
  1266.       obstack_1grow (&inline_text_obstack, yychar);
  1267.       while (c >= 0)
  1268.     {
  1269.       int this_lineno = lineno;
  1270.  
  1271.       c = yynextch ();
  1272.  
  1273.       /* Don't lose our cool if there are lots of comments.  */
  1274.       if (lineno - this_lineno)
  1275.         if (lineno - this_lineno == 1)
  1276.           obstack_1grow (&inline_text_obstack, '\n');
  1277.         else
  1278.           {
  1279.         char buf[12];
  1280.         sprintf (buf, "\n# %d \"", lineno);
  1281.         len = strlen (buf);
  1282.         obstack_grow (&inline_text_obstack, buf, len);
  1283.  
  1284.         len = strlen (input_filename);
  1285.         obstack_grow (&inline_text_obstack, input_filename, len);
  1286.         obstack_1grow (&inline_text_obstack, '\"');
  1287.         obstack_1grow (&inline_text_obstack, '\n');
  1288.           }
  1289.  
  1290.       /* strings must be read differently than text.  */
  1291.       if (c == '\"')
  1292.         {
  1293.           obstack_1grow (&inline_text_obstack, c);
  1294.           consume_string (&inline_text_obstack);
  1295.           c = yynextch ();
  1296.         }
  1297.       while (c > ' ')    /* ASCII dependent! */
  1298.         {
  1299.           obstack_1grow (&inline_text_obstack, c);
  1300.           if (c == '{') goto main_loop;
  1301.           if (c == '\"')
  1302.         consume_string (&inline_text_obstack);
  1303.           c = getc (finput);
  1304.         }
  1305.       if (c == '\n')
  1306.         lineno++;
  1307.       obstack_1grow (&inline_text_obstack, c);
  1308.     }
  1309.     }
  1310.   else obstack_1grow (&inline_text_obstack, '{');
  1311.  
  1312.  main_loop:
  1313.   while (c >= 0)
  1314.     {
  1315.       int this_lineno = lineno;
  1316.  
  1317.       c = skip_white_space (getc (finput));
  1318.  
  1319.       /* Don't lose our cool if there are lots of comments.  */
  1320.       if (lineno - this_lineno)
  1321.     if (lineno - this_lineno == 1)
  1322.       obstack_1grow (&inline_text_obstack, '\n');
  1323.     else
  1324.       {
  1325.         char buf[12];
  1326.         sprintf (buf, "\n# %d \"", lineno);
  1327.         len = strlen (buf);
  1328.         obstack_grow (&inline_text_obstack, buf, len);
  1329.  
  1330.         len = strlen (input_filename);
  1331.         obstack_grow (&inline_text_obstack, input_filename, len);
  1332.         obstack_1grow (&inline_text_obstack, '\"');
  1333.         obstack_1grow (&inline_text_obstack, '\n');
  1334.       }
  1335.  
  1336.       while (c > ' ')
  1337.     {
  1338.       obstack_1grow (&inline_text_obstack, c);
  1339.       if (c == '{') blev++;
  1340.       else if (c == '}')
  1341.         {
  1342.           blev--;
  1343.           if (blev == 0)
  1344.         goto done;
  1345.         }
  1346.       else if (c == '\"')
  1347.         consume_string (&inline_text_obstack);
  1348.       c = getc (finput);
  1349.     }
  1350.       if (c == '\n')
  1351.     lineno++;
  1352.       obstack_1grow (&inline_text_obstack, c);
  1353.     }
  1354.  done:
  1355.   current_base_init_list = NULL_TREE;
  1356.   current_member_init_list = NULL_TREE;
  1357.  
  1358. #ifdef USG_STDIO
  1359.   len = obstack_object_size (&inline_text_obstack);
  1360.   /* If the buffer given to setvbuf is shorter than eight bytes long,
  1361.      setvbuf will (in violation of its man page) ignore the buffer
  1362.      and call malloc to get a bigger one.  */
  1363.   while (len < 8)
  1364.     {
  1365.       len++;
  1366.       obstack_1grow (&inline_text_obstack, ' ');
  1367.     }
  1368. #endif
  1369.  
  1370.   obstack_1grow (&inline_text_obstack, '\0');
  1371.   len = obstack_object_size (&inline_text_obstack);
  1372.  
  1373.   if (fndecl == void_type_node)
  1374.     {
  1375.       /* Happens when we get two declarations of the same
  1376.      function in the same scope.  */
  1377.       char *buf = obstack_base (&inline_text_obstack);
  1378.       obstack_free (&inline_text_obstack, buf);
  1379.       return;
  1380.     }
  1381.   else
  1382.     {
  1383.       struct pending_inline *t;
  1384.       char *buf = obstack_base (&inline_text_obstack);
  1385.  
  1386.       obstack_finish (&inline_text_obstack);
  1387.  
  1388.       t = (struct pending_inline *) obstack_alloc (&inline_text_obstack,
  1389.                            sizeof (struct pending_inline));
  1390.       t->buf = buf;
  1391.       t->len = len;
  1392.       t->lineno = starting_lineno;
  1393.       t->filename = input_filename;
  1394.       t->token = YYEMPTY;
  1395.       DECL_PENDING_INLINE_INFO (fndecl) = t;
  1396.     }
  1397. }
  1398.  
  1399. /* Build a default function named NAME for type TYPE.
  1400.    KIND says what to build.  Currently only two kinds of default functions
  1401.    are recognized:
  1402.  
  1403.    When KIND == 0, build default X(X&) constructor.
  1404.    When KIND == 1, build default destructor.  */
  1405.  
  1406. tree
  1407. cons_up_default_function (type, name, kind)
  1408.      tree type, name;
  1409.      int kind;
  1410. {
  1411.   extern tree void_list_node;
  1412.   int len;
  1413.   tree fn, args;
  1414.   tree argtype;
  1415.  
  1416.   switch (kind)
  1417.     {
  1418.     case 0:
  1419.       /* Destructor.  */
  1420.       name = build_parse_node (BIT_NOT_EXPR, name);
  1421.       /* Fall through...  */
  1422.     case 2:
  1423.       /* Default constructor.  */
  1424.       args = void_list_node;
  1425.       break;
  1426.  
  1427.     case 3:
  1428.       type = build_type_variant (type, 1, 0);
  1429.       /* Fall through...  */
  1430.     case 1:
  1431.       argtype = build_reference_type (type);
  1432.       args = tree_cons (NULL_TREE,
  1433.             build_tree_list (hash_tree_chain (argtype, NULL_TREE),
  1434.                      get_identifier ("arg")),
  1435.             void_list_node);
  1436.       break;
  1437.  
  1438.     default:
  1439.       abort ();
  1440.     }
  1441.  
  1442.   fn = start_method (NULL_TREE,
  1443.              build_parse_node (CALL_EXPR, name, args, NULL_TREE),
  1444.              NULL_TREE);
  1445.   if (fn == void_type_node)
  1446.     return fn;
  1447.  
  1448.   obstack_1grow (&inline_text_obstack, '{');
  1449.   obstack_1grow (&inline_text_obstack, '}');
  1450. #ifdef USG_STDIO
  1451.   len = 2;
  1452.   while (len++ < 8)
  1453.     obstack_1grow (&inline_text_obstack, ' ');
  1454. #endif
  1455.  
  1456.   obstack_1grow (&inline_text_obstack, '\0');
  1457.   current_base_init_list = NULL_TREE;
  1458.   current_member_init_list = NULL_TREE;
  1459.  
  1460.   len = obstack_object_size (&inline_text_obstack);
  1461.  
  1462.   {
  1463.     struct pending_inline *t;
  1464.     char *buf = obstack_base (&inline_text_obstack);
  1465.  
  1466.     obstack_finish (&inline_text_obstack);
  1467.  
  1468.     t = (struct pending_inline *) obstack_alloc (&inline_text_obstack,
  1469.                          sizeof (struct pending_inline));
  1470.     t->buf = buf;
  1471.     t->len = len;
  1472.     t->lineno = lineno;
  1473.     t->filename = input_filename;
  1474.     t->token = YYEMPTY;
  1475.     DECL_PENDING_INLINE_INFO (fn) = t;
  1476.     /* We make this declaration private (static in the C sense).  */
  1477.     TREE_PUBLIC (fn) = 0;
  1478.   }
  1479.   finish_method (fn);
  1480.   DECL_COMPILER_GENERATED_P (fn) = 1;
  1481.   return fn;
  1482. }
  1483.  
  1484. /* Heuristic to tell whether the user is missing a semicolon
  1485.    after a struct or enum declaration.  Emit an error message
  1486.    if we know the user has blown it.  */
  1487. void
  1488. check_for_missing_semicolon (type)
  1489.      tree type;
  1490. {
  1491.   if (yychar < 0)
  1492.     yychar = yylex ();
  1493.  
  1494.   if (yychar > 255
  1495.       && yychar != IDENTIFIER
  1496.       && yychar != TYPENAME)
  1497.     {
  1498.       if (ANON_AGGRNAME_P (DECL_NAME (TYPE_NAME (type))))
  1499.     error ("semicolon missing after %s declaration",
  1500.            TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
  1501.       else
  1502.     error ("semicolon missing after declaration of `%s'",
  1503.            TYPE_NAME_STRING (type));
  1504.       shadow_tag (build_tree_list (0, type));
  1505.     }
  1506.   /* Could probably also hack cases where class { ... } f (); appears.  */
  1507. }
  1508.  
  1509. void
  1510. note_got_semicolon (type)
  1511.      tree type;
  1512. {
  1513.   if (IS_AGGR_TYPE (type))
  1514.     CLASSTYPE_GOT_SEMICOLON (type) = 1;
  1515. }
  1516.  
  1517. /* If C is not whitespace, return C.
  1518.    Otherwise skip whitespace and return first nonwhite char read.  */
  1519.  
  1520. static int
  1521. skip_white_space (c)
  1522.      register int c;
  1523. {
  1524. #if 0
  1525.   register int inside;
  1526. #endif
  1527.  
  1528.   for (;;)
  1529.     {
  1530.       switch (c)
  1531.     {
  1532.       /* Don't recognize comments in cc1: all comments are removed by cpp,
  1533.          and cpp output can include / and * consecutively as operators.  */
  1534. #if 0
  1535.     case '/':
  1536.       c = getc (finput);
  1537.       if (c != '*' && c != '/')
  1538.         {
  1539.           ungetc (c, finput);
  1540.           return '/';
  1541.         }
  1542.  
  1543.       if (c == '/')
  1544.         {
  1545.           while (c != EOF)
  1546.         {
  1547.           c = getc (finput);
  1548.           if (c == '\n')
  1549.             {
  1550.               ungetc (c, finput);
  1551.               break;
  1552.             }
  1553.         }
  1554.           if (c == EOF)
  1555.         {
  1556.           error ("unterminated comment");
  1557.           return EOF;
  1558.         }
  1559.           c = getc (finput);
  1560.           break;
  1561.         }
  1562.  
  1563.       c = getc (finput);
  1564.  
  1565.       inside = 1;
  1566.       while (inside)
  1567.         {
  1568.           if (c == '*')
  1569.         {
  1570.           while (c == '*')
  1571.             c = getc (finput);
  1572.  
  1573.           if (c == '/')
  1574.             {
  1575.               inside = 0;
  1576.               c = getc (finput);
  1577.             }
  1578.         }
  1579.           else if (c == '\n')
  1580.         {
  1581.           lineno++;
  1582.           c = getc (finput);
  1583.         }
  1584.           else if (c == EOF)
  1585.         {
  1586.           error ("unterminated comment");
  1587.           break;
  1588.         }
  1589.           else
  1590.         c = getc (finput);
  1591.         }
  1592.  
  1593.       break;
  1594. #endif
  1595.  
  1596.     case '\n':
  1597.       c = check_newline ();
  1598.       break;
  1599.  
  1600.     case ' ':
  1601.     case '\t':
  1602.     case '\f':
  1603.     case '\r':
  1604.     case '\v':
  1605.     case '\b':
  1606.       do
  1607.         c = getc (finput);
  1608.       while (c == ' ' || c == '\t');
  1609.       break;
  1610.  
  1611.     case '\\':
  1612.       c = getc (finput);
  1613.       if (c == '\n')
  1614.         lineno++;
  1615.       else
  1616.         error ("stray '\\' in program");
  1617.       c = getc (finput);
  1618.       break;
  1619.  
  1620.     default:
  1621.       return (c);
  1622.     }
  1623.     }
  1624. }
  1625.  
  1626.  
  1627.  
  1628. /* Make the token buffer longer, preserving the data in it.
  1629.    P should point to just beyond the last valid character in the old buffer.
  1630.    The value we return is a pointer to the new buffer
  1631.    at a place corresponding to P.  */
  1632.  
  1633. static char *
  1634. extend_token_buffer (p)
  1635.      char *p;
  1636. {
  1637.   int offset = p - token_buffer;
  1638.  
  1639.   maxtoken = maxtoken * 2 + 10;
  1640.   token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
  1641.  
  1642.   return token_buffer + offset;
  1643. }
  1644.  
  1645. #ifndef MERGED
  1646. /* This includes code from write_segment, stolen from unexec.c */
  1647.  
  1648. void dump_data()
  1649. {
  1650.   int new;
  1651.   register caddr_t ptr, end;
  1652.   register int i, nwrite, ret;
  1653.   char buf[80];
  1654.   extern int errno;
  1655.   char zeros[128];
  1656.  
  1657.   extern int been_here_before, just_done_unexec, my_edata;
  1658.   extern char *dump_source_name;
  1659.   extern char *asm_file_name, previous_asm_file_name[];
  1660.   char dump_file_name[256];    /* Fixed-sized buffer -- sigh. */
  1661.   caddr_t end_of_heap;
  1662.   int data_size, token;
  1663.   register int c;
  1664.  
  1665.   bzero (zeros, sizeof zeros);
  1666.  
  1667.   /* Here we have just seen `#pragma dump '.
  1668.      The name to dump to, a string constant, may follow.  */
  1669.  
  1670.   do
  1671.     c = getch (finput);
  1672.   while (c == ' ' || c == '\t');
  1673.  
  1674.   /* If no argument, default to something like "dumped-cc1plus".  */
  1675.   if (c == '\n')
  1676.     {
  1677.       char *tmp;
  1678.       strcpy (dump_file_name, "dumped-");
  1679.       if (tmp = strrchr (dump_source_name, '/'))
  1680.     dump_source_name = tmp + 1;
  1681.       strcat (dump_file_name, dump_source_name);
  1682.     }
  1683.   else
  1684.     {
  1685.       ungetc (c, finput);
  1686.       token = yylex ();
  1687.       if (token != STRING
  1688.       || TREE_CODE (yylval.ttype) != STRING_CST)
  1689.     {
  1690.       error ("invalid #pragma dump");
  1691.       return;
  1692.     }
  1693.  
  1694.       strcpy (dump_file_name, TREE_STRING_POINTER (yylval.ttype));
  1695.     }
  1696.  
  1697.   been_here_before = 1;        /* Raise the flag! */
  1698.   strcpy(previous_asm_file_name, asm_file_name);
  1699.   printf("\nDumping %s to %s...\n", dump_source_name, dump_file_name);
  1700.  
  1701.   end_of_heap = (caddr_t)sbrk(0);
  1702.   data_size = (int)(end_of_heap- (caddr_t)(&my_edata));
  1703.   printf("Data size = %d\n", data_size);
  1704.           
  1705.   new = creat (dump_file_name, 0666);
  1706.  
  1707.   ptr = (caddr_t)&my_edata;
  1708.   end = end_of_heap;
  1709.  
  1710.   for (i = 0; ptr < end;)
  1711.     {
  1712.       /* distance to next multiple of 128.  */
  1713.       nwrite = (((int) ptr + 128) & -128) - (int) ptr;
  1714.       /* But not beyond specified end.  */
  1715.       if (nwrite > end - ptr) nwrite = end - ptr;
  1716.       ret = write (new, ptr, nwrite);
  1717.       /* If write gets a page fault, it means we reached
  1718.      a gap between the old text segment and the old data segment.
  1719.      This gap has probably been remapped into part of the text segment.
  1720.      So write zeros for it.  */
  1721.       if (ret == -1 && errno == EFAULT)
  1722.     write (new, zeros, nwrite);
  1723.       else if (nwrite != ret)
  1724.     {
  1725.       sprintf (buf,
  1726.            "unexec write failure: addr 0x%x, fileno %d, size 0x%x, wrote 0x%x, errno %d",
  1727.            ptr, new, nwrite, ret, errno);
  1728.       perror (buf);
  1729.       return;
  1730.     }
  1731.       i += nwrite;
  1732.       ptr += nwrite;
  1733.     }
  1734.  
  1735.   close (new);
  1736.  
  1737.   just_done_unexec = 1;        /* Tell toplev not to output ending. */
  1738. }
  1739. #endif
  1740.  
  1741. /* At the beginning of a line, increment the line number
  1742.    and process any #-directive on this line.
  1743.    If the line is a #-directive, read the entire line and return a newline.
  1744.    Otherwise, return the line's first non-whitespace character.  */
  1745.  
  1746. int
  1747. check_newline ()
  1748. {
  1749.   register int c;
  1750.   register int token;
  1751.  
  1752.   lineno++;
  1753.  
  1754.   /* Read first nonwhite char on the line.  */
  1755.  
  1756.   do
  1757.     c = getc (finput);
  1758.   while (c == ' ' || c == '\t');
  1759.  
  1760.   if (c != '#')
  1761.     {
  1762.       /* If not #, return it so caller will use it.  */
  1763.       return c;
  1764.     }
  1765.  
  1766.   /* Read first nonwhite char after the `#'.  */
  1767.  
  1768.   do
  1769.     c = getc (finput);
  1770.   while (c == ' ' || c == '\t');
  1771.  
  1772.   /* If a letter follows, then if the word here is `line', skip
  1773.      it and ignore it; otherwise, ignore the line, with an error
  1774.      if the word isn't `pragma'.  */
  1775.  
  1776.   if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
  1777.     {
  1778.       if (c == 'p')
  1779.     {
  1780.       if (getch (finput) == 'r'
  1781.           && getch (finput) == 'a'
  1782.           && getch (finput) == 'g'
  1783.           && getch (finput) == 'm'
  1784.           && getch (finput) == 'a')
  1785. /* Change by Bryan Boreham, Kewill, Sun Jul 23 15:53:24 1989.
  1786.    This whole section added to support dumping of
  1787.    compilations in the middle. */
  1788.         {
  1789.           /* Read first nonwhite char after the `#pragma'.  */
  1790.           do
  1791.         c = getch (finput);
  1792.           while (c == ' ' || c == '\t');
  1793.  
  1794. #ifndef MERGED
  1795.           /* See if it is "dump" */
  1796.  
  1797.           if (c == 'd'
  1798.           && getch (finput) == 'u'
  1799.           && getch (finput) == 'm'
  1800.           && getch (finput) == 'p'
  1801.           && ((c = getch (finput)) == ' ' || c == '\t' || c == '\n'))
  1802.         {
  1803. #ifdef VMS
  1804.             ;        /* Are you crazy? */
  1805. #else
  1806.           ungetc (c, finput);
  1807.           dump_data();
  1808.           longjmp (toplevel, 1);
  1809. #endif
  1810.         }
  1811.           else
  1812. #endif
  1813.         if (c == 'v'
  1814.                && getch (finput) == 't'
  1815.                && getch (finput) == 'a'
  1816.                && getch (finput) == 'b'
  1817.                && getch (finput) == 'l'
  1818.                && getch (finput) == 'e'
  1819.                && ((c = getch (finput)) == ' ' || c == '\t' || c == '\n'))
  1820.         {
  1821.           extern tree pending_vtables;
  1822.  
  1823.           /* More follows: it must be a string constant (class name).  */
  1824.           token = yylex ();
  1825.           if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
  1826.             {
  1827.               error ("invalid #pragma vtable");
  1828.               goto skipline;
  1829.             }
  1830.           if (write_virtuals != 2)
  1831.             {
  1832.               warning ("use `+e2' option to enable #pragma vtable");
  1833.               goto skipline;
  1834.             }
  1835.           pending_vtables = perm_tree_cons (NULL_TREE, get_identifier (TREE_STRING_POINTER (yylval.ttype)), pending_vtables);
  1836.           if (nextchar < 0)
  1837.             nextchar = getch (finput);
  1838.           c = nextchar;
  1839.           if (c != '\n')
  1840.             warning ("trailing characters ignored");
  1841.         }
  1842.           else if (c == 'u'
  1843.                && getch (finput) == 'n'
  1844.                && getch (finput) == 'i'
  1845.                && getch (finput) == 't'
  1846.                && ((c = getch (finput)) == ' ' || c == '\t' || c == '\n'))
  1847.         {
  1848.           /* More follows: it must be a string constant (unit name).  */
  1849.           token = yylex ();
  1850.           if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
  1851.             {
  1852.               error ("invalid #pragma unit");
  1853.               goto skipline;
  1854.             }
  1855.           current_unit_name = get_identifier (TREE_STRING_POINTER (yylval.ttype));
  1856.           current_unit_language = current_lang_name;
  1857.           if (nextchar < 0)
  1858.             nextchar = getch (finput);
  1859.           c = nextchar;
  1860.           if (c != '\n')
  1861.             warning ("trailing characters ignored");
  1862.         }
  1863.         }
  1864.       goto skipline;
  1865.     }
  1866.  
  1867.       else if (c == 'l')
  1868.     {
  1869.       if (getch (finput) == 'i'
  1870.           && getch (finput) == 'n'
  1871.           && getch (finput) == 'e'
  1872.           && ((c = getch (finput)) == ' ' || c == '\t'))
  1873.         goto linenum;
  1874.     }
  1875.       else if (c == 'i')
  1876.     {
  1877.       if (getch (finput) == 'd'
  1878.           && getch (finput) == 'e'
  1879.           && getch (finput) == 'n'
  1880.           && getch (finput) == 't'
  1881.           && ((c = getch (finput)) == ' ' || c == '\t'))
  1882.         {
  1883.           /* Conditionally used.  */
  1884.               extern FILE *asm_out_file;
  1885.  
  1886.           if (pedantic)
  1887.         error ("ANSI C does not allow #ident");
  1888.  
  1889.           /* Here we have just seen `#ident '.
  1890.          A string constant should follow.  */
  1891.  
  1892.           while (c == ' ' || c == '\t')
  1893.         c = getch (finput);
  1894.  
  1895.           /* If no argument, ignore the line.  */
  1896.           if (c == '\n')
  1897.         return c;
  1898.  
  1899.           ungetc (c, finput);
  1900.           token = yylex ();
  1901.           if (token != STRING
  1902.           || TREE_CODE (yylval.ttype) != STRING_CST)
  1903.         {
  1904.           error ("invalid #ident");
  1905.           goto skipline;
  1906.         }
  1907.  
  1908. #ifdef ASM_OUTPUT_IDENT
  1909.           ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (yylval.ttype));
  1910. #endif
  1911.  
  1912.           /* Skip the rest of this line.  */
  1913.           goto skipline;
  1914.         }
  1915.     }
  1916.       else if (c == 'n')
  1917.     {
  1918.       if (getch (finput) == 'e'
  1919.           && getch (finput) == 'w'
  1920.           && getch (finput) == 'w'
  1921.           && getch (finput) == 'o'
  1922.           && getch (finput) == 'r'
  1923.           && getch (finput) == 'l'
  1924.           && getch (finput) == 'd'
  1925.           && ((c = getch (finput)) == ' ' || c == '\t'))
  1926.         {
  1927.           /* Used to test incremental compilation.  */
  1928.           sorry ("#pragma newworld");
  1929.           goto skipline;
  1930.         }
  1931.     }
  1932.       error ("undefined or invalid # directive");
  1933.       goto skipline;
  1934.     }
  1935.  
  1936. linenum:
  1937.   /* Here we have either `#line' or `# <nonletter>'.
  1938.      In either case, it should be a line number; a digit should follow.  */
  1939.  
  1940.   while (c == ' ' || c == '\t')
  1941.     c = getc (finput);
  1942.  
  1943.   /* If the # is the only nonwhite char on the line,
  1944.      just ignore it.  Check the new newline.  */
  1945.   if (c == '\n')
  1946.     return c;
  1947.  
  1948.   /* Something follows the #; read a token.  */
  1949.  
  1950.   ungetc (c, finput);
  1951.   token = yylex ();
  1952.  
  1953.   if (token == CONSTANT
  1954.       && TREE_CODE (yylval.ttype) == INTEGER_CST)
  1955.     {
  1956.       int old_lineno = lineno;
  1957.       /* subtract one, because it is the following line that
  1958.      gets the specified number */
  1959.  
  1960.       int l = TREE_INT_CST_LOW (yylval.ttype) - 1;
  1961.  
  1962.       /* Is this the last nonwhite stuff on the line?  */
  1963.       if (nextchar >= 0)
  1964.     c = nextchar, nextchar = -1;
  1965.       else
  1966.     c = getc (finput);
  1967.  
  1968.       while (c == ' ' || c == '\t')
  1969.     c = getc (finput);
  1970.       if (c == '\n')
  1971.     {
  1972.       /* No more: store the line number and check following line.  */
  1973.       lineno = l;
  1974.       return c;
  1975.     }
  1976.       ungetc (c, finput);
  1977.  
  1978.       /* More follows: it must be a string constant (filename).  */
  1979.  
  1980.       token = yylex ();
  1981.       if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
  1982.     {
  1983.       error ("invalid #line");
  1984.       goto skipline;
  1985.     }
  1986.  
  1987.       /* Changing files again.  This means currently collected time
  1988.      is charged against header time, and body time starts back
  1989.      at 0.  */
  1990.       if (flag_detailed_statistics)
  1991.     {
  1992.       int this_time = my_gettime ();
  1993.       tree time_identifier = get_time_identifier (TREE_STRING_POINTER (yylval.ttype));
  1994.       header_time += this_time - body_time;
  1995.       TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (this_filename_time))
  1996.         += this_time - body_time;
  1997.       this_filename_time = time_identifier;
  1998.       body_time = this_time;
  1999.     }
  2000.  
  2001.       input_filename
  2002.     = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
  2003.       strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
  2004.       lineno = l;
  2005.  
  2006.       if (main_input_filename == 0)
  2007.     main_input_filename = input_filename;
  2008.  
  2009.       /* Is this the last nonwhite stuff on the line?  */
  2010.       if (nextchar >= 0)
  2011.     c = nextchar, nextchar = -1;
  2012.       else
  2013.     c = getc (finput);
  2014.  
  2015.       while (c == ' ' || c == '\t')
  2016.     c = getc (finput);
  2017.       if (c == '\n')
  2018.     return c;
  2019.       ungetc (c, finput);
  2020.  
  2021.       token = yylex ();
  2022.  
  2023.       /* `1' after file name means entering new file.
  2024.      `2' after file name means just left a file.  */
  2025.  
  2026.       if (token == CONSTANT
  2027.       && TREE_CODE (yylval.ttype) == INTEGER_CST)
  2028.     {
  2029.       if (TREE_INT_CST_LOW (yylval.ttype) == 1)
  2030.         {
  2031.           struct file_stack *p
  2032.         = (struct file_stack *) xmalloc (sizeof (struct file_stack));
  2033.           input_file_stack->line = old_lineno;
  2034.           p->next = input_file_stack;
  2035.           p->name = input_filename;
  2036.           input_file_stack = p;
  2037.           input_file_stack_tick++;
  2038.         }
  2039.       else if (input_file_stack->next)
  2040.         {
  2041.           struct file_stack *p = input_file_stack;
  2042.           input_file_stack = p->next;
  2043.           free (p);
  2044.           input_file_stack_tick++;
  2045.         }
  2046.       else
  2047.         error ("#-lines for entering and leaving files don't match");
  2048.     }
  2049.       /* If NEXTCHAR is not end of line, we don't care what it is.  */
  2050.       if (nextchar == '\n')
  2051.     return '\n';
  2052.     }
  2053.   else
  2054.     error ("invalid #-line");
  2055.  
  2056.   /* skip the rest of this line.  */
  2057.  skipline:
  2058.   if (c == '\n')
  2059.     return c;
  2060.   while ((c = getc (finput)) != EOF && c != '\n');
  2061.   return c;
  2062. }
  2063.  
  2064. #if 0
  2065. #define isalnum(char) (char >= 'a' ? char <= 'z' : char >= '0' ? char <= '9' || (char >= 'A' && char <= 'Z') : 0)
  2066. #define isdigit(char) (char >= '0' && char <= '9')
  2067. #else
  2068. #include <ctype.h>
  2069. #endif
  2070.  
  2071. #define ENDFILE -1  /* token that represents end-of-file */
  2072.  
  2073. static int
  2074. readescape ()
  2075. {
  2076.   register int c = getc (finput);
  2077.   register int count, code;
  2078.   int firstdig;
  2079.  
  2080.   switch (c)
  2081.     {
  2082.     case 'x':
  2083.       code = 0;
  2084.       count = 0;
  2085.       while (1)
  2086.     {
  2087.       c = getc (finput);
  2088.       if (! isxdigit (c))
  2089.         {
  2090.           ungetc (c, finput);
  2091.           break;
  2092.         }
  2093.       code *= 16;
  2094.       if (c >= 'a' && c <= 'f')
  2095.         code += c - 'a' + 10;
  2096.       if (c >= 'A' && c <= 'F')
  2097.         code += c - 'A' + 10;
  2098.       if (c >= '0' && c <= '9')
  2099.         code += c - '0';
  2100.       if (count == 0)
  2101.         firstdig = code;
  2102.       count++;
  2103.     }
  2104.       if (count == 0)
  2105.     error ("\\x used with no following hex digits");
  2106.       else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
  2107.            || ((1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
  2108.            <= firstdig))
  2109.     warning ("hex escape out of range");
  2110.       return code;
  2111.  
  2112.     case '0':  case '1':  case '2':  case '3':  case '4':
  2113.     case '5':  case '6':  case '7':
  2114.       code = 0;
  2115.       count = 0;
  2116.       while ((c <= '7') && (c >= '0') && (count++ < 3))
  2117.     {
  2118.       code = (code * 8) + (c - '0');
  2119.       c = getc (finput);
  2120.     }
  2121.       ungetc (c, finput);
  2122.       return code;
  2123.  
  2124.     case '\\': case '\'': case '"':
  2125.       return c;
  2126.  
  2127.     case '\n':
  2128.       lineno++;
  2129.       return -1;
  2130.  
  2131.     case 'n':
  2132.       return TARGET_NEWLINE;
  2133.  
  2134.     case 't':
  2135.       return TARGET_TAB;
  2136.  
  2137.     case 'r':
  2138.       return TARGET_CR;
  2139.  
  2140.     case 'f':
  2141.       return TARGET_FF;
  2142.  
  2143.     case 'b':
  2144.       return TARGET_BS;
  2145.  
  2146.     case 'a':
  2147.       return TARGET_BELL;
  2148.  
  2149.     case 'v':
  2150.       return TARGET_VT;
  2151.  
  2152.     case 'E':
  2153.       return 033;
  2154.  
  2155.     case '?':
  2156.       /* `\(', etc, are used at beginning of line to avoid confusing Emacs.  */
  2157.     case '(':
  2158.     case '{':
  2159.     case '[':
  2160.       return c;
  2161.     }
  2162.   if (c >= 040 && c <= 0177)
  2163.     warning ("unknown escape sequence `\\%c'", c);
  2164.   else
  2165.     warning ("unknown escape sequence: `\\' followed by char code 0x%x", c);
  2166.   return c;
  2167. }
  2168.  
  2169. /* Value is 1 if we should try to make the next identifier look like a
  2170.    typename (when it may be a local variable or a class variable).
  2171.    Value is 0 if we treat this name in a default fashion.
  2172.    Value is -1 if we must not see a type name.  */
  2173. int looking_for_typename = 0;
  2174.  
  2175. void
  2176. dont_see_typename ()
  2177. {
  2178.   looking_for_typename = -1;
  2179.   if (yychar == TYPENAME)
  2180.     {
  2181.       yychar = IDENTIFIER;
  2182.       lastiddecl = 0;
  2183.     }
  2184. }
  2185.  
  2186. void
  2187. see_typename ()
  2188. {
  2189.   looking_for_typename = 0;
  2190.   if (yychar == IDENTIFIER)
  2191.     {
  2192.       lastiddecl = lookup_name (yylval.ttype);
  2193.       if (lastiddecl == 0 && flag_labels_ok)
  2194.     lastiddecl = IDENTIFIER_LABEL_VALUE (yylval.ttype);
  2195.       else if (lastiddecl != 0
  2196.       && TREE_CODE (lastiddecl) == TYPE_DECL)
  2197.     yychar = TYPENAME;
  2198.     }
  2199. }
  2200.  
  2201. int
  2202. yylex ()
  2203. {
  2204.   tree tmp;
  2205.   register int c;
  2206.   register int value;
  2207.   int wide_flag = 0;
  2208.   int dollar_seen = 0;
  2209.  
  2210.  relex:
  2211.   if (nextyychar >= 0)
  2212.     {
  2213.       value = nextyychar;
  2214.       yylval = nextyylval;
  2215.       lastiddecl = nextlastiddecl;
  2216.       nextyychar = -1;
  2217.       if (value == IDENTIFIER)
  2218.     {
  2219.       tmp = yylval.ttype;
  2220.       goto resume_identifier_processing;
  2221.     }
  2222.       goto done;
  2223.     }
  2224.   if (nextchar >= 0)
  2225.     c = nextchar, nextchar = -1;
  2226.   else
  2227.     c = getc (finput);
  2228.  
  2229.   /* Effectively do c = skip_white_space (c)
  2230.      but do it faster in the usual cases.  */
  2231.   while (1)
  2232.     switch (c)
  2233.       {
  2234.       case ' ':
  2235.       case '\t':
  2236.       case '\f':
  2237.       case '\r':
  2238.       case '\v':
  2239.       case '\b':
  2240.     c = getc (finput);
  2241.     break;
  2242.  
  2243.       case '\n':
  2244.       case '/':
  2245.       case '\\':
  2246.     c = skip_white_space (c);
  2247.       default:
  2248.     goto found_nonwhite;
  2249.       }
  2250.  found_nonwhite:
  2251.  
  2252.   token_buffer[0] = c;
  2253.   token_buffer[1] = 0;
  2254.  
  2255. /*  yylloc.first_line = lineno; */
  2256.  
  2257.   switch (c)
  2258.     {
  2259.     case EOF:
  2260.       token_buffer[0] = '\0';
  2261.       if (pending_inlines)
  2262.     {
  2263.       struct pending_inline *t;
  2264.  
  2265.       t = pending_inlines;
  2266. #ifdef DO_METHODS_THE_OLD_WAY
  2267.       yylval.itype = t->token_value;
  2268.       value = t->token;
  2269. #else
  2270.       if (t->fndecl == 0)
  2271.         {
  2272.           yylval.itype = t->token_value;
  2273.           value = t->token;
  2274.         }
  2275.       else
  2276.         {
  2277.           yylval.ttype = t->fndecl;
  2278.           value = PRE_PARSED_FUNCTION_DECL;
  2279.         }
  2280. #endif
  2281.  
  2282.       lineno = t->lineno;
  2283. /*        yylloc.first_line = lineno; */
  2284.       input_filename = t->filename;
  2285.  
  2286.       if (t->next)
  2287.         {
  2288.           /* The buffer we used will be freed at the
  2289.          end of this function.  */
  2290.           pending_inlines = pending_inlines->next;
  2291. #if defined(i386) && !defined(sequent) && !defined(sun386)
  2292.           finput2->_ptr = finput2->_base = t->buf;
  2293.           _bufend(finput2) = t->buf + t->len;
  2294.           finput2->_flag = _IOFBF | _IOREAD;
  2295.           finput2->_cnt = t->len - 1;
  2296. #else
  2297. #ifndef hp9000s300
  2298. #ifdef USG_STDIO
  2299.                 setvbuf(finput2,t->buf,_IOFBF,t->len);
  2300.                  finput2->_cnt = t->len-1;
  2301. #else
  2302. #ifdef VMS
  2303.           setvbuf(finput2,t->buf,_IOFBF,t->len);
  2304.           (*finput2)->_cnt = t->len-1;
  2305. #else
  2306.           setbuffer (finput2, t->buf, t->len);
  2307. #ifdef sprite
  2308.           finput2->readCount = finput2->bufSize - 1;
  2309. #else          
  2310.           finput2->_cnt = finput2->_bufsiz - 1;
  2311. #endif          
  2312. #endif                /* VMS */
  2313. #endif                /* USG_STDIO */
  2314. #else
  2315.                 setvbuf(finput2,t->buf,_IOFBF,t->len);
  2316.                  finput2->_cnt = t->len-1;
  2317. #endif
  2318. #endif
  2319.         }
  2320.       else
  2321.         {
  2322.           pending_inlines = NULL;
  2323.           finput = finput1;
  2324.           obstack_free (&inline_text_obstack, inline_text_firstobj);
  2325.         }
  2326.       /* The space used by T will be freed after all inline
  2327.          functions have been processed.  */
  2328.       if (value <= 0)
  2329.         goto relex;
  2330.       else
  2331.         goto done;
  2332.     }
  2333.       end_of_file = 1;
  2334.       value = ENDFILE;
  2335.       break;
  2336.  
  2337.     case '$':
  2338.       if (dollars_in_ident)
  2339.     {
  2340.       dollar_seen = 1;
  2341.       goto letter;
  2342.     }
  2343.       value = '$';
  2344.       goto done;
  2345.  
  2346.     case 'L':
  2347.       /* Capital L may start a wide-string or wide-character constant.  */
  2348.       {
  2349.     register int c = getc (finput);
  2350.     if (c == '\'')
  2351.       {
  2352.         wide_flag = 1;
  2353.         goto char_constant;
  2354.       }
  2355.     if (c == '"')
  2356.       {
  2357.         wide_flag = 1;
  2358.         goto string_constant;
  2359.       }
  2360.     ungetc (c, finput);
  2361.       }
  2362.  
  2363.     case 'A':  case 'B':  case 'C':  case 'D':  case 'E':
  2364.     case 'F':  case 'G':  case 'H':  case 'I':  case 'J':
  2365.     case 'K':          case 'M':  case 'N':  case 'O':
  2366.     case 'P':  case 'Q':  case 'R':  case 'S':  case 'T':
  2367.     case 'U':  case 'V':  case 'W':  case 'X':  case 'Y':
  2368.     case 'Z':
  2369.     case 'a':  case 'b':  case 'c':  case 'd':  case 'e':
  2370.     case 'f':  case 'g':  case 'h':  case 'i':  case 'j':
  2371.     case 'k':  case 'l':  case 'm':  case 'n':  case 'o':
  2372.     case 'p':  case 'q':  case 'r':  case 's':  case 't':
  2373.     case 'u':  case 'v':  case 'w':  case 'x':  case 'y':
  2374.     case 'z':
  2375.     case '_':
  2376.     letter:
  2377.       {
  2378.     register char *p;
  2379.  
  2380.     p = token_buffer;
  2381.     while (isalnum(c) || (c == '_') || c == '$')
  2382.       {
  2383.         if (p >= token_buffer + maxtoken)
  2384.           p = extend_token_buffer (p);
  2385.         if (c == '$' && ! dollars_in_ident)
  2386.           break;
  2387.  
  2388.         *p++ = c;
  2389.         c = getc (finput);
  2390.       }
  2391.  
  2392.     *p = 0;
  2393.     nextchar = c;
  2394.  
  2395.     value = IDENTIFIER;
  2396.     yylval.itype = 0;
  2397.  
  2398.       /* Try to recognize a keyword.  Uses minimum-perfect hash function */
  2399.  
  2400.     {
  2401.       register struct resword *ptr;
  2402.  
  2403.       if (ptr = is_reserved_word (token_buffer, p - token_buffer))
  2404.         {
  2405.           if (current_lang_name != lang_name_cplusplus)
  2406.         {
  2407.           if (ptr->rid != 0
  2408.               && (ptr->rid == RID_CLASS
  2409.               || ptr->rid == RID_FRIEND
  2410.               || ptr->rid == RID_VIRTUAL
  2411.               || (flag_no_asm && ptr->rid == RID_INLINE)))
  2412.             {
  2413.               ptr = 0;
  2414.               goto not_reserved_word_after_all;
  2415.             }
  2416.           if (flag_traditional
  2417.               && ((int) ptr->token == TYPEOF
  2418.               || ptr->rid == RID_SIGNED
  2419.               || ptr->rid == RID_INLINE))
  2420.             {
  2421.               ptr = 0;
  2422.               goto not_reserved_word_after_all;
  2423.             }  
  2424.         }
  2425.           if (ptr->rid)
  2426.         {
  2427.           tree old_ttype = ridpointers[(int) ptr->rid];
  2428.  
  2429.           /* If this provides a type for us, then revert lexical
  2430.              state to standard state.  */
  2431.           if (TREE_CODE (old_ttype) == IDENTIFIER_NODE
  2432.               && IDENTIFIER_GLOBAL_VALUE (old_ttype) != 0
  2433.               && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (old_ttype)) == TYPE_DECL)
  2434.             looking_for_typename = 0;
  2435.  
  2436.           /* Check if this is a language-type declaration.
  2437.              Just glimpse the next non-white character.  */
  2438.           nextchar = skip_white_space (nextchar);
  2439.           if (nextchar == '"')
  2440.             {
  2441.               /* We are looking at a string.  Complain
  2442.              if the token before the string is no `extern'.
  2443.              
  2444.              Could cheat some memory by placing this string
  2445.              on the temporary_, instead of the saveable_
  2446.              obstack.  */
  2447.  
  2448.               if (ptr->rid != RID_EXTERN)
  2449.             error ("invalid modifier `%s' for language string",
  2450.                    ptr->name);
  2451.               yylex ();
  2452.               value = EXTERN_LANG_STRING;
  2453.               yylval.ttype = get_identifier (TREE_STRING_POINTER (yylval.ttype));
  2454.               break;
  2455.             }
  2456.           yylval.ttype = old_ttype;
  2457.         }
  2458.           value = (int) ptr->token;
  2459.         }
  2460.       not_reserved_word_after_all:
  2461.       ;
  2462.     }
  2463.  
  2464.     /* If we did not find a keyword, look for an identifier
  2465.        (or a typename).  */
  2466.  
  2467.     if (value == IDENTIFIER)
  2468.       {
  2469.         tmp = get_identifier (token_buffer);
  2470.  
  2471. #ifndef VMS
  2472.         /* Make sure that user does not collide with our internal
  2473.            naming scheme.  */
  2474.         if (JOINER == '$'
  2475.         && dollar_seen
  2476.         && (THIS_NAME_P (tmp)
  2477.             || VPTR_NAME_P (tmp)
  2478.             || DESTRUCTOR_NAME_P (tmp)
  2479.             || WRAPPER_OR_ANTI_WRAPPER_NAME_P (tmp)
  2480.             || OPERATOR_NAME_P (tmp)
  2481.             || VTABLE_NAME_P (tmp)
  2482.             || OPERATOR_TYPENAME_P (tmp)
  2483.             || TEMP_NAME_P (tmp)
  2484.             || ANON_AGGRNAME_P (tmp)
  2485.             || ANON_PARMNAME_P (tmp)))
  2486.           warning ("identifier name `%s' conflicts with GNU C++ internal naming strategy",
  2487.                token_buffer);
  2488. #endif
  2489.  
  2490.         /* Come into here if we must reprocess an identifier.  */
  2491.       resume_identifier_processing:
  2492.  
  2493.         if (looking_for_typename == 1
  2494.         && TREE_TYPE (tmp) != 0)
  2495.           lastiddecl = TREE_TYPE (tmp);
  2496.         else lastiddecl = lookup_name (tmp);
  2497.  
  2498.         if (lastiddecl && TREE_CODE (lastiddecl) == TYPE_DECL
  2499.         && looking_for_typename >= 0)
  2500.           {
  2501.         /* This call could blow away yylval.  */
  2502.  
  2503.         c = skip_white_space (nextchar);
  2504.         if (c == ':')
  2505.           {
  2506.             c = getc (finput);
  2507.             if (c == ':')
  2508.               {
  2509.             nextchar = -1;
  2510.             value = TYPENAME_SCOPE;
  2511.               }
  2512.             else
  2513.               {
  2514.             nextchar = c;
  2515.             value = TYPENAME_COLON;
  2516.               }
  2517.           }
  2518.         else if (c == '.'
  2519.              && current_function_decl == NULL_TREE
  2520.              && current_class_type == NULL_TREE)
  2521.           {
  2522.             c = getc (finput);
  2523.             if (c == '.')
  2524.               {
  2525.             nextchar = -1;
  2526.             c = getc (finput);
  2527.             if (c != '.')
  2528.               error ("missing '.' in `...'");
  2529.             value = TYPENAME_ELLIPSIS;
  2530.             tmp = build_tree_list (NULL_TREE, build_tree_list (TREE_TYPE (lastiddecl), NULL_TREE));
  2531.               }
  2532.             else
  2533.               {
  2534.             nextchar = c;
  2535.             warning ("use of obsolete scope operator `.'; use `::' instead");
  2536.             value = TYPENAME_SCOPE;
  2537.               }
  2538.             looking_for_typename = 0;
  2539.           }
  2540.         else
  2541.           {
  2542.             nextchar = c;
  2543.             value = TYPENAME;
  2544.             if (looking_for_typename == 1)
  2545.               {
  2546.             looking_for_typename = 0;
  2547. #if 0
  2548.             yylval.ttype = TREE_TYPE (lastiddecl);
  2549.             break;
  2550. #endif
  2551.               }
  2552.           }
  2553.           }
  2554.         else if (lastiddecl == 0 && flag_labels_ok)
  2555.           lastiddecl = IDENTIFIER_LABEL_VALUE (tmp);
  2556.  
  2557.         yylval.ttype = tmp;
  2558.       }
  2559.     if (value == NEW && ! global_bindings_p ())
  2560.       {
  2561.         looking_for_typename = 1;
  2562.         value = NEW;
  2563.         goto done;
  2564.       }
  2565.       }
  2566.       break;
  2567.  
  2568.     case '0':  case '1':  case '2':  case '3':  case '4':
  2569.     case '5':  case '6':  case '7':  case '8':  case '9':
  2570.     case '.':
  2571.       {
  2572.     register char *p;
  2573.     int base = 10;
  2574.     int count = 0;
  2575.     int largest_digit = 0;
  2576.     int numdigits = 0;
  2577.     /* for multi-precision arithmetic,
  2578.        we store only 8 live bits in each short,
  2579.        giving us 64 bits of reliable precision */
  2580.     short shorts[8];
  2581.  
  2582.     enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS} floatflag
  2583.       = NOT_FLOAT;
  2584.  
  2585.     p = token_buffer;
  2586.     *p++ = c;
  2587.  
  2588.     /* Optimize for most frequent case.  */
  2589.     if (c == '0' || c == '1')
  2590.       {
  2591.         register int c1 = getc (finput);
  2592.         if (! isalnum (c1) && c1 != '.')
  2593.           {
  2594.         /* Terminate string.  */
  2595.         *p = 0;
  2596.         if (c == '0')
  2597.           yylval.ttype = integer_zero_node;
  2598.         else
  2599.           yylval.ttype = integer_one_node;
  2600.         nextchar = c1;
  2601.         value = CONSTANT;
  2602.         goto done;
  2603.           }
  2604.         ungetc (c1, finput);
  2605.       }
  2606.  
  2607.     for (count = 0; count < 8; count++)
  2608.       shorts[count] = 0;
  2609.  
  2610.     if (c == '0')
  2611.       {
  2612.         *p++ = (c = getch (finput));
  2613.         if ((c == 'x') || (c == 'X'))
  2614.           {
  2615.         base = 16;
  2616.         *p++ = (c = getch (finput));
  2617.           }
  2618.         else
  2619.           {
  2620.         base = 8;
  2621.         numdigits++;
  2622.           }
  2623.       }
  2624.  
  2625.     /* Read all the digits-and-decimal-points.  */
  2626.  
  2627.     while (c == '.'
  2628.            || (isalnum (c) && (c != 'l') && (c != 'L')
  2629.            && (c != 'u') && (c != 'U')
  2630.            && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
  2631.       {
  2632.         if (c == '.')
  2633.           {
  2634.         if (base == 16)
  2635.           error ("floating constant may not be in radix 16");
  2636.         if (floatflag == AFTER_POINT)
  2637.           {
  2638.             error ("malformed floating constant");
  2639.             floatflag = TOO_MANY_POINTS;
  2640.           }
  2641.         else
  2642.           floatflag = AFTER_POINT;
  2643.  
  2644.         base = 10;
  2645.         *p++ = c = getc (finput);
  2646.         /* Accept '.' as the start of a floating-point number
  2647.            only when it is followed by a digit.
  2648.            Otherwise, unread the following non-digit
  2649.            and use the '.' as a structural token.  */
  2650.         if (p == token_buffer + 2 && !isdigit (c))
  2651.           {
  2652.             if (c == '.')
  2653.               {
  2654.             c = getc (finput);
  2655.             if (c == '.')
  2656.               {
  2657.                 *p++ = '.';
  2658.                 *p = '\0';
  2659.                 value = ELLIPSIS;
  2660.                 goto done;
  2661.               }
  2662.             nextchar = c;
  2663.             token_buffer[2] = '\0';
  2664.             value = RANGE;
  2665.             goto done;
  2666.               }
  2667.             nextchar = c;
  2668.             token_buffer[1] = '\0';
  2669.             value = '.';
  2670.             goto done;
  2671.           }
  2672.           }
  2673.         else
  2674.           {
  2675.         /* It is not a decimal point.
  2676.            It should be a digit (perhaps a hex digit).  */
  2677.  
  2678.         if (isdigit (c))
  2679.           {
  2680.             c = c - '0';
  2681.           }
  2682.         else if (base <= 10)
  2683.           {
  2684.             if ((c&~040) == 'E')
  2685.               {
  2686.             base = 10;
  2687.             floatflag = AFTER_POINT;
  2688.             break;   /* start of exponent */
  2689.               }
  2690.             error ("nondigits in number and not hexadecimal");
  2691.             c = 0;
  2692.           }
  2693.         else if (c >= 'a')
  2694.           {
  2695.             c = c - 'a' + 10;
  2696.           }
  2697.         else
  2698.           {
  2699.             c = c - 'A' + 10;
  2700.           }
  2701.         if (c >= largest_digit)
  2702.           largest_digit = c;
  2703.         numdigits++;
  2704.  
  2705.         for (count = 0; count < 8; count++)
  2706.           {
  2707.             (shorts[count] *= base);
  2708.             if (count)
  2709.               {
  2710.             shorts[count] += (shorts[count-1] >> 8);
  2711.             shorts[count-1] &= (1<<8)-1;
  2712.               }
  2713.             else shorts[0] += c;
  2714.           }
  2715.  
  2716.         if (p >= token_buffer + maxtoken - 3)
  2717.           p = extend_token_buffer (p);
  2718.         *p++ = (c = getc (finput));
  2719.           }
  2720.       }
  2721.  
  2722.     if (numdigits == 0)
  2723.       error ("numeric constant with no digits");
  2724.  
  2725.     if (largest_digit >= base)
  2726.       error ("numeric constant contains digits beyond the radix");
  2727.  
  2728.     /* Remove terminating char from the token buffer and delimit the string */
  2729.     *--p = 0;
  2730.  
  2731.     if (floatflag != NOT_FLOAT)
  2732.       {
  2733.         tree type = double_type_node;
  2734.         char f_seen = 0;
  2735.         char l_seen = 0;
  2736.         double value;
  2737.  
  2738.         /* Read explicit exponent if any, and put it in tokenbuf.  */
  2739.  
  2740.         if ((c == 'e') || (c == 'E'))
  2741.           {
  2742.         if (p >= token_buffer + maxtoken - 3)
  2743.           p = extend_token_buffer (p);
  2744.         *p++ = c;
  2745.         c = getc (finput);
  2746.         if ((c == '+') || (c == '-'))
  2747.           {
  2748.             *p++ = c;
  2749.             c = getc (finput);
  2750.           }
  2751.         if (! isdigit (c))
  2752.           error ("floating constant exponent has no digits");
  2753.             while (isdigit (c))
  2754.           {
  2755.             if (p >= token_buffer + maxtoken - 3)
  2756.               p = extend_token_buffer (p);
  2757.             *p++ = c;
  2758.             c = getc (finput);
  2759.           }
  2760.           }
  2761.  
  2762.         *p = 0;
  2763.         errno = 0;
  2764.         value = atof (token_buffer);
  2765. #ifdef ERANGE
  2766.         if (errno == ERANGE && !flag_traditional)
  2767.           {
  2768.         char *p1 = token_buffer;
  2769.         /* Check for "0.0" and variants;
  2770.            Sunos 4 spuriously returns ERANGE for them.  */
  2771.         while (*p1 == '0') p1++;
  2772.         if (*p1 == '.') p1++;
  2773.         while (*p1 == '0') p1++;
  2774.         if (*p1 != 0)
  2775.           warning ("floating point number exceeds range of `double'");
  2776.           }
  2777. #endif
  2778.  
  2779.         /* Read the suffixes to choose a data type.  */
  2780.         while (1)
  2781.           {
  2782.         if (c == 'f' || c == 'F')
  2783.           {
  2784.             if (f_seen)
  2785.               error ("two `f's in floating constant");
  2786.             f_seen = 1;
  2787.             type = float_type_node;
  2788.           }
  2789.         else if (c == 'l' || c == 'L')
  2790.           {
  2791.             if (l_seen)
  2792.               error ("two `l's in floating constant");
  2793.             l_seen = 1;
  2794.             type = long_double_type_node;
  2795.           }
  2796.         else
  2797.           {
  2798.             if (isalnum (c))
  2799.               {
  2800.             error ("garbage at end of number");
  2801.             while (isalnum (c))
  2802.               {
  2803.                 if (p >= token_buffer + maxtoken - 3)
  2804.                   p = extend_token_buffer (p);
  2805.                 *p++ = c;
  2806.                 c = getc (finput);
  2807.               }
  2808.               }
  2809.             break;
  2810.           }
  2811.         if (p >= token_buffer + maxtoken - 3)
  2812.           p = extend_token_buffer (p);
  2813.         *p++ = c;
  2814.         c = getc (finput);
  2815.           }
  2816.  
  2817.         /* Create a node with determined type and value.  */
  2818.         yylval.ttype = build_real (type, value);
  2819.  
  2820.         ungetc (c, finput);
  2821.         *p = 0;
  2822.       }
  2823.     else
  2824.       {
  2825.         tree type;
  2826.         int spec_unsigned = 0;
  2827.         int spec_long = 0;
  2828.  
  2829.         while (1)
  2830.           {
  2831.         if (c == 'u' || c == 'U')
  2832.           {
  2833.             if (spec_unsigned)
  2834.               error ("two `u's in integer constant");
  2835.             spec_unsigned = 1;
  2836.           }
  2837.         else if (c == 'l' || c == 'L')
  2838.           {
  2839.             if (spec_long)
  2840.               error ("two `l's in integer constant");
  2841.             spec_long = 1;
  2842.           }
  2843.         else
  2844.           {
  2845.             if (isalnum (c))
  2846.               {
  2847.             error ("garbage at end of number");
  2848.             while (isalnum (c))
  2849.               {
  2850.                 if (p >= token_buffer + maxtoken - 3)
  2851.                   p = extend_token_buffer (p);
  2852.                 *p++ = c;
  2853.                 c = getc (finput);
  2854.               }
  2855.               }
  2856.             break;
  2857.           }
  2858.         if (p >= token_buffer + maxtoken - 3)
  2859.           p = extend_token_buffer (p);
  2860.         *p++ = c;
  2861.         c = getc (finput);
  2862.           }
  2863.  
  2864.         ungetc (c, finput);
  2865.  
  2866.         if (shorts[7] | shorts[6] | shorts[5] | shorts[4])
  2867.           warning ("integer constant out of range");
  2868.  
  2869.         /* This is simplified by the fact that our constant
  2870.            is always positive.  */
  2871.         yylval.ttype
  2872.           = build_int_2 ((shorts[3]<<24) + (shorts[2]<<16) + (shorts[1]<<8) + shorts[0],
  2873.                  0);
  2874.  
  2875.         if (!spec_long && !spec_unsigned
  2876.         && int_fits_type_p (yylval.ttype, integer_type_node))
  2877.           type = integer_type_node;
  2878.  
  2879.         else if (!spec_long && base != 10
  2880.              && int_fits_type_p (yylval.ttype, unsigned_type_node))
  2881.           type = unsigned_type_node;
  2882.  
  2883.         else if (!spec_unsigned
  2884.              && int_fits_type_p (yylval.ttype, long_integer_type_node))
  2885.           type = long_integer_type_node;
  2886.  
  2887.         else
  2888.           {
  2889.         type = long_unsigned_type_node;
  2890.         if (! int_fits_type_p (yylval.ttype, long_unsigned_type_node))
  2891.           warning ("integer constant out of range");
  2892.           }
  2893.         TREE_TYPE (yylval.ttype) = type;
  2894.       }
  2895.  
  2896.     value = CONSTANT; break;
  2897.       }
  2898.  
  2899.     case '\'':
  2900.     char_constant:
  2901.       {
  2902.     register int result = 0;
  2903.     register num_chars = 0;
  2904.     int width = TYPE_PRECISION (char_type_node);
  2905.     int max_chars;
  2906.  
  2907.     if (wide_flag) width = TYPE_PRECISION (integer_type_node);
  2908.  
  2909.     max_chars = TYPE_PRECISION (integer_type_node) / width;
  2910.  
  2911.     while (1)
  2912.       {
  2913.       tryagain:
  2914.  
  2915.         c = getc (finput);
  2916.  
  2917.         if (c == '\'' || c == EOF)
  2918.           break;
  2919.  
  2920.         if (c == '\\')
  2921.           {
  2922.         c = readescape ();
  2923.         if (c < 0)
  2924.           goto tryagain;
  2925.         if (width < HOST_BITS_PER_INT
  2926.             && (unsigned) c >= (1 << width))
  2927.           warning ("escape sequence out of range for character");
  2928.           }
  2929.         else if (c == '\n')
  2930.           {
  2931.         if (pedantic)
  2932.           warning ("ANSI C forbids newline in character constant");
  2933.         lineno++;
  2934.           }
  2935.  
  2936.         num_chars++;
  2937.         if (num_chars > maxtoken - 4)
  2938.           extend_token_buffer (token_buffer);
  2939.  
  2940.         token_buffer[num_chars] = c;
  2941.  
  2942.         /* Merge character into result; ignore excess chars.  */
  2943.         if (num_chars < max_chars + 1)
  2944.           {
  2945.         if (width < HOST_BITS_PER_INT)
  2946.           result = (result << width) | (c & ((1 << width) - 1));
  2947.         else
  2948.           result = c;
  2949.           }
  2950.       }
  2951.  
  2952.     token_buffer[num_chars + 1] = '\'';
  2953.     token_buffer[num_chars + 2] = 0;
  2954.  
  2955.     if (c != '\'')
  2956.       error ("malformatted character constant");
  2957.     else if (num_chars == 0)
  2958.       error ("empty character constant");
  2959.     else if (num_chars > max_chars)
  2960.       {
  2961.         num_chars = max_chars;
  2962.         error ("character constant too long");
  2963.       }
  2964.     else if (num_chars != 1 && ! flag_traditional)
  2965.       warning ("multi-character character constant");
  2966.  
  2967.     /* If char type is signed, sign-extend the constant.  */
  2968.     if (! wide_flag)
  2969.       {
  2970.         int num_bits = num_chars * width;
  2971.         if (TREE_UNSIGNED (char_type_node)
  2972.         || ((result >> (num_bits - 1)) & 1) == 0)
  2973.           yylval.ttype
  2974.         = build_int_2 (result & ((unsigned) ~0
  2975.                      >> (HOST_BITS_PER_INT - num_bits)),
  2976.                    0);
  2977.         else
  2978.           yylval.ttype
  2979.         = build_int_2 (result | ~((unsigned) ~0
  2980.                       >> (HOST_BITS_PER_INT - num_bits)),
  2981.                    -1);
  2982.         TREE_TYPE (yylval.ttype) = char_type_node;
  2983.       }
  2984.     else
  2985.       {
  2986.         yylval.ttype = build_int_2 (result, 0);
  2987.         TREE_TYPE (yylval.ttype) = integer_type_node;
  2988.       }
  2989.     value = CONSTANT; break;
  2990.       }
  2991.  
  2992.     case '"':
  2993.     string_constant:
  2994.       {
  2995.     int *widep;
  2996.     register char *p;
  2997.  
  2998.     c = getc (finput);
  2999.     p = token_buffer + 1;
  3000.  
  3001.     if (wide_flag)
  3002.       widep = wide_buffer;
  3003.  
  3004.     while (c != '"' && c >= 0)
  3005.       {
  3006.         if (c == '\\')
  3007.           {
  3008.         c = readescape ();
  3009.         if (c < 0)
  3010.           goto skipnewline;
  3011.         if (!wide_flag && c >= (1 << BITS_PER_UNIT))
  3012.           warning ("escape sequence out of range for character");
  3013.           }
  3014.         else if (c == '\n')
  3015.           {
  3016.         if (pedantic)
  3017.           warning ("ANSI C forbids newline in string constant");
  3018.         lineno++;
  3019.           }
  3020.  
  3021.         /* Store the char in C into the appropriate buffer.  */
  3022.  
  3023.         if (wide_flag)
  3024.           {
  3025.         if (widep == wide_buffer + max_wide)
  3026.           {
  3027.             int n = widep - wide_buffer;
  3028.             max_wide *= 2;
  3029.             wide_buffer = (int *) xrealloc (wide_buffer, max_wide + 1);
  3030.             widep = wide_buffer + n;
  3031.           }
  3032.         *widep++ = c;
  3033.           }
  3034.         else
  3035.           {
  3036.         if (p == token_buffer + maxtoken)
  3037.           p = extend_token_buffer (p);
  3038.         *p++ = c;
  3039.           }
  3040.  
  3041.       skipnewline:
  3042.         c = getc (finput);
  3043.         if (c == EOF) {
  3044.         error("Unterminated string");
  3045.         break;
  3046.         }
  3047.       }
  3048.  
  3049.     /* We have read the entire constant.
  3050.        Construct a STRING_CST for the result.  */
  3051.  
  3052.     if (wide_flag)
  3053.       {
  3054.         /* If this is a L"..." wide-string, make a vector
  3055.            of the ints in wide_buffer.  */
  3056.         *widep = 0;
  3057.         /* We have not implemented the case where `int'
  3058.            on the target and on the execution machine differ in size.  */
  3059.         assert (TYPE_PRECISION (integer_type_node) == sizeof (int) * BITS_PER_UNIT);
  3060.         yylval.ttype = build_string ((widep - wide_buffer) * sizeof (int),
  3061.                      (char *)wide_buffer);
  3062.         TREE_TYPE (yylval.ttype) = int_array_type_node;
  3063.       }
  3064.     else
  3065.       {
  3066.         *p = 0;
  3067.         yylval.ttype = build_string (p - token_buffer, token_buffer + 1);
  3068.         TREE_TYPE (yylval.ttype) = char_array_type_node;
  3069.       }
  3070.  
  3071.     *p++ = '"';
  3072.     *p = 0;
  3073.  
  3074.     value = STRING; break;
  3075.       }
  3076.  
  3077.     case '+':
  3078.     case '-':
  3079.     case '&':
  3080.     case '|':
  3081.     case '<':
  3082.     case '>':
  3083.     case '*':
  3084.     case '/':
  3085.     case '%':
  3086.     case '^':
  3087.     case '!':
  3088.     case '=':
  3089.       {
  3090.     register int c1;
  3091.  
  3092.       combine:
  3093.  
  3094.     switch (c)
  3095.       {
  3096.       case '+':
  3097.         yylval.code = PLUS_EXPR; break;
  3098.       case '-':
  3099.         yylval.code = MINUS_EXPR; break;
  3100.       case '&':
  3101.         yylval.code = BIT_AND_EXPR; break;
  3102.       case '|':
  3103.         yylval.code = BIT_IOR_EXPR; break;
  3104.       case '*':
  3105.         yylval.code = MULT_EXPR; break;
  3106.       case '/':
  3107.         yylval.code = TRUNC_DIV_EXPR; break;
  3108.       case '%':
  3109.         yylval.code = TRUNC_MOD_EXPR; break;
  3110.       case '^':
  3111.         yylval.code = BIT_XOR_EXPR; break;
  3112.       case LSHIFT:
  3113.         yylval.code = LSHIFT_EXPR; break;
  3114.       case RSHIFT:
  3115.         yylval.code = RSHIFT_EXPR; break;
  3116.       case '<':
  3117.         yylval.code = LT_EXPR; break;
  3118.       case '>':
  3119.         yylval.code = GT_EXPR; break;
  3120.       }
  3121.  
  3122.     token_buffer[1] = c1 = getc (finput);
  3123.     token_buffer[2] = 0;
  3124.  
  3125.     if (c1 == '=')
  3126.       {
  3127.         switch (c)
  3128.           {
  3129.           case '<':
  3130.         value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
  3131.           case '>':
  3132.         value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
  3133.           case '!':
  3134.         value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
  3135.           case '=':
  3136.         value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
  3137.           }
  3138.         value = ASSIGN; goto done;
  3139.       }
  3140.     else if (c == c1)
  3141.       switch (c)
  3142.         {
  3143.         case '+':
  3144.           value = PLUSPLUS; goto done;
  3145.         case '-':
  3146.           value = MINUSMINUS; goto done;
  3147.         case '&':
  3148.           value = ANDAND; goto done;
  3149.         case '|':
  3150.           value = OROR; goto done;
  3151.         case '<':
  3152.           c = LSHIFT;
  3153.           goto combine;
  3154.         case '>':
  3155.           c = RSHIFT;
  3156.           goto combine;
  3157.         }
  3158.     else if ((c == '-') && (c1 == '>'))
  3159.       {
  3160.         nextchar = skip_white_space (getc (finput));
  3161.         if (nextchar == '(')
  3162.           {
  3163.         int next_c = skip_white_space (' ');
  3164.         if (next_c == ')')
  3165.           {
  3166.             nextchar = -1;
  3167.             value = POINTSAT_LEFT_RIGHT;
  3168.             goto done;
  3169.           }
  3170.         ungetc (next_c, finput);
  3171.           }
  3172.         value = POINTSAT;
  3173.         goto done;
  3174.       }
  3175.     else if (c1 == '?' && (c == '<' || c == '>'))
  3176.       {
  3177.         token_buffer[3] = 0;
  3178.  
  3179.         c1 = getch (finput);
  3180.         yylval.code = (c == '<' ? MIN_EXPR : MAX_EXPR);
  3181.         if (c1 == '=')
  3182.           {
  3183.         /* <?= or >?= expression.  */
  3184.         token_buffer[2] = c1;
  3185.         value = ASSIGN;
  3186.           }
  3187.         else
  3188.           {
  3189.         value = MIN_MAX;
  3190.         nextchar = c1;
  3191.           }
  3192.         if (pedantic)
  3193.           error ("use of `operator %s' is not standard C++",
  3194.              token_buffer);
  3195.         goto done;
  3196.       }
  3197.  
  3198.     nextchar = c1;
  3199.     token_buffer[1] = 0;
  3200.  
  3201.     if ((c == '<') || (c == '>'))
  3202.       value = ARITHCOMPARE;
  3203.     else value = c;
  3204.     goto done;
  3205.       }
  3206.  
  3207.     case ':':
  3208.       c = getc (finput);
  3209.       if (c == ':')
  3210.     {
  3211.       token_buffer[1] = ':';
  3212.       token_buffer[2] = '\0';
  3213.       value = SCOPE;
  3214.       yylval.itype = 1;
  3215.     }
  3216.       else
  3217.     {
  3218.       nextchar = c;
  3219.       value = ':';
  3220.     }
  3221.       break;
  3222.  
  3223.     case 0:
  3224.       /* Don't make yyparse think this is eof.  */
  3225.       value = 1;
  3226.       break;
  3227.  
  3228.     case '(':
  3229.       /* try, weakly, to handle casts to pointers to functions.  */
  3230.       nextchar = skip_white_space (getc (finput));
  3231.       if (nextchar == '*')
  3232.     {
  3233.       int next_c = skip_white_space (' ');
  3234.       if (next_c == ')')
  3235.         {
  3236.           nextchar = -1;
  3237.           yylval.ttype = build1 (INDIRECT_REF, 0, 0);
  3238.           value = PAREN_STAR_PAREN;
  3239.         }
  3240.       else
  3241.         {
  3242.           ungetc (next_c, finput);
  3243.           value = c;
  3244.         }
  3245.     }
  3246.       /* Go down for a (X::*) or (X::&).  */
  3247.       else if (isalpha (nextchar) || nextchar == '_' || nextchar == '$')
  3248.     {
  3249.       YYSTYPE this_yylval = yylval;
  3250.       tree this_lastiddecl = lastiddecl;
  3251.       nextyychar = yylex ();
  3252.       if (nextyychar == TYPENAME_SCOPE)
  3253.         {
  3254.           if (nextchar < 0)
  3255.         nextchar = skip_white_space (getc (finput));
  3256.           if (nextchar == '*' || nextchar == '&')
  3257.         {
  3258.           int next_c = skip_white_space (' ');
  3259.           if (next_c == ')')
  3260.             {
  3261.               nextyychar = -1;
  3262.               if (nextchar == '*')
  3263.             {
  3264.               value = PAREN_X_SCOPE_STAR_PAREN;
  3265.               yylval.ttype = build_parse_node (SCOPE_REF, yylval.ttype,
  3266.                                build_parse_node (INDIRECT_REF, 0));
  3267.             }
  3268.               else
  3269.             {
  3270.               value = PAREN_X_SCOPE_REF_PAREN;
  3271.               yylval.ttype = build_parse_node (SCOPE_REF, yylval.ttype,
  3272.                                build_parse_node (ADDR_EXPR, 0));
  3273.             }
  3274.               nextchar = -1;
  3275.             }
  3276.           else
  3277.             {
  3278.               ungetc (next_c, finput);
  3279.               nextyylval = yylval;
  3280.               nextlastiddecl = lastiddecl;
  3281.               yylval = this_yylval;
  3282.               lastiddecl = this_lastiddecl;
  3283.               value = c;
  3284.             }
  3285.         }
  3286.           else
  3287.         {
  3288.           nextyylval = yylval;
  3289.           nextlastiddecl = lastiddecl;
  3290.           yylval = this_yylval;
  3291.           lastiddecl = this_lastiddecl;
  3292.           value = c;
  3293.         }
  3294.         }
  3295.       else
  3296.         {
  3297.           nextyylval = yylval;
  3298.           nextlastiddecl = lastiddecl;
  3299.           yylval = this_yylval;
  3300.           lastiddecl = this_lastiddecl;
  3301.           value = c;
  3302.         }
  3303.     }
  3304.       else if (nextchar == ')')
  3305.     {
  3306.       nextchar = -1;
  3307.       yylval.ttype = NULL_TREE;
  3308.       value = LEFT_RIGHT;
  3309.     }
  3310.       else value = c;
  3311.       break;
  3312.  
  3313.     default:
  3314.       value = c;
  3315.     }
  3316.  
  3317. done:
  3318. /*  yylloc.last_line = lineno; */
  3319. #ifdef GATHER_STATISTICS
  3320.   token_count[value] += 1;
  3321. #endif
  3322.  
  3323.   return value;
  3324. }
  3325.  
  3326. typedef enum
  3327. {
  3328.   d_kind, t_kind, s_kind, r_kind, e_kind, c_kind,
  3329.   id_kind, op_id_kind, perm_list_kind, temp_list_kind,
  3330.   x_kind, lang_decl, lang_type, all_kinds
  3331. } tree_node_kind;
  3332. extern int tree_node_kinds[];
  3333. extern int tree_node_sizes[];
  3334. extern char *tree_node_kind_names[];
  3335.  
  3336. /* Place to save freed lang_decls which were allocated on the
  3337.    permanent_obstack.  @@ Not currently used.  */
  3338. tree free_lang_decl_chain;
  3339.  
  3340. tree
  3341. build_lang_decl (code, name, type)
  3342.      enum tree_code code;
  3343.      tree name;
  3344.      tree type;
  3345. {
  3346.   extern struct obstack *current_obstack, *saveable_obstack;
  3347.   extern struct obstack permanent_obstack;
  3348.   register tree t = build_decl (code, name, type);
  3349.   struct obstack *obstack = current_obstack;
  3350.   register int i = sizeof (struct lang_decl) / sizeof (int);
  3351.   register int *pi;
  3352.  
  3353.   if (! TREE_PERMANENT (t))
  3354.     obstack = saveable_obstack;
  3355.  
  3356. #ifdef LANG_DECL_PERMANENT
  3357.   if (free_lang_decl_chain && obstack == &permanent_obstack)
  3358.     {
  3359.       pi = (int *)free_lang_decl_chain;
  3360.       free_lang_decl_chain = TREE_CHAIN (free_lang_decl_chain);
  3361.     }
  3362.   else
  3363.     pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl));
  3364. #else
  3365.   pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl));
  3366. #endif
  3367.  
  3368.   while (i > 0)
  3369.     pi[--i] = 0;
  3370.  
  3371.   DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi;
  3372. #ifdef LANG_DECL_PERMANENT
  3373.   LANG_DECL_PERMANENT ((struct lang_decl *) pi)
  3374.     = obstack == &permanent_obstack;
  3375. #endif
  3376.   DECL_MAIN_VARIANT (t) = t;
  3377.   DECL_ORIGINAL_NAME (t) = name;
  3378.   if (current_lang_name == lang_name_cplusplus)
  3379.     {
  3380.       DECL_LANGUAGE (t) = lang_cplusplus;
  3381.  
  3382. #ifndef NO_AUTO_OVERLOAD
  3383.       if (code == FUNCTION_DECL && name != 0
  3384.       && ! (IDENTIFIER_LENGTH (name) == 4
  3385.         && IDENTIFIER_POINTER (name)[0] == 'm'
  3386.         && strcmp (IDENTIFIER_POINTER (name), "main") == 0)
  3387.       && ! (IDENTIFIER_LENGTH (name) > 10
  3388.         && IDENTIFIER_POINTER (name)[0] == '_'
  3389.         && IDENTIFIER_POINTER (name)[1] == '_'
  3390.         && strncmp (IDENTIFIER_POINTER (name)+2, "builtin_", 8) == 0))
  3391.     TREE_OVERLOADED (name) = 1;
  3392. #endif
  3393.     }
  3394.   else if (current_lang_name == lang_name_c)
  3395.     DECL_LANGUAGE (t) = lang_c;
  3396.   else abort ();
  3397.  
  3398. #ifdef GATHER_STATISTICS
  3399.   tree_node_kinds[(int)lang_decl] += 1;
  3400.   tree_node_sizes[(int)lang_decl] += sizeof(struct lang_decl);
  3401. #endif
  3402.  
  3403.   return t;
  3404. }
  3405.  
  3406. tree
  3407. build_lang_field_decl (code, name, type)
  3408.      enum tree_code code;
  3409.      tree name;
  3410.      tree type;
  3411. {
  3412.   extern struct obstack *current_obstack, *saveable_obstack;
  3413.   register tree t = build_decl (code, name, type);
  3414.   struct obstack *obstack = current_obstack;
  3415.   register int i = sizeof (struct lang_decl_flags) / sizeof (int);
  3416.   register int *pi;
  3417.  
  3418.   if (! TREE_PERMANENT (t))
  3419.     obstack = saveable_obstack;
  3420.  
  3421.   pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl_flags));
  3422.   while (i > 0)
  3423.     pi[--i] = 0;
  3424.  
  3425.   DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi;
  3426.   return t;
  3427. }
  3428.  
  3429. tree
  3430. make_lang_type (code)
  3431.      enum tree_code code;
  3432. {
  3433.   extern struct obstack *current_obstack, *saveable_obstack;
  3434.   register tree t = make_node (code);
  3435.   struct obstack *obstack = current_obstack;
  3436.   register int i = sizeof (struct lang_type) / sizeof (int);
  3437.   register int *pi;
  3438.  
  3439.   if (! TREE_PERMANENT (t))
  3440.     obstack = saveable_obstack;
  3441.  
  3442.   pi = (int *) obstack_alloc (obstack, sizeof (struct lang_type));
  3443.   while (i > 0)
  3444.     pi[--i] = 0;
  3445.  
  3446.   TYPE_LANG_SPECIFIC (t) = (struct lang_type *) pi;
  3447.   CLASSTYPE_MAIN_VARIANT (t) = t;
  3448.   CLASSTYPE_AS_LIST (t) = build_tree_list (NULL_TREE, t);
  3449.  
  3450.   /* Make sure this is laid out, for ease of use later.
  3451.      In the presence of parse errors, the normal was of assuring
  3452.      this might not ever get executed, so we lay it out *immediately*.  */
  3453.   build_pointer_type (t);
  3454.  
  3455. #ifdef GATHER_STATISTICS
  3456.   tree_node_kinds[(int)lang_type] += 1;
  3457.   tree_node_sizes[(int)lang_type] += sizeof(struct lang_type);
  3458. #endif
  3459.  
  3460.   return t;
  3461. }
  3462.  
  3463. void
  3464. copy_decl_lang_specific (decl)
  3465.      tree decl;
  3466. {
  3467.   extern struct obstack *current_obstack, *saveable_obstack;
  3468.   register int *old = (int *)DECL_LANG_SPECIFIC (decl);
  3469.   struct obstack *obstack = current_obstack;
  3470.   register int i = sizeof (struct lang_decl) / sizeof (int);
  3471.   register int *pi;
  3472.  
  3473.   if (! TREE_PERMANENT (decl))
  3474.     obstack = saveable_obstack;
  3475.  
  3476.   pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl));
  3477.   while (i-- > 0)
  3478.     pi[i] = old[i];
  3479.  
  3480.   DECL_LANG_SPECIFIC (decl) = (struct lang_decl *) pi;
  3481.  
  3482. #ifdef GATHER_STATISTICS
  3483.   tree_node_kinds[(int)lang_decl] += 1;
  3484.   tree_node_sizes[(int)lang_decl] += sizeof(struct lang_decl);
  3485. #endif
  3486. }
  3487.  
  3488. void
  3489. copy_type_lang_specific (type)
  3490.      tree type;
  3491. {
  3492.   extern struct obstack *current_obstack, *saveable_obstack;
  3493.   register int *old = (int *)TYPE_LANG_SPECIFIC (type);
  3494.   struct obstack *obstack = current_obstack;
  3495.   register int i = sizeof (struct lang_type) / sizeof (int);
  3496.   register int *pi;
  3497.  
  3498.   if (! TREE_PERMANENT (type))
  3499.     obstack = saveable_obstack;
  3500.  
  3501.   pi = (int *) obstack_alloc (obstack, sizeof (struct lang_type));
  3502.   while (i-- > 0)
  3503.     pi[i] = old[i];
  3504.  
  3505.   TYPE_LANG_SPECIFIC (type) = (struct lang_type *) pi;
  3506.   CLASSTYPE_AS_LIST (type) = build_tree_list (NULL_TREE, type);
  3507.   if (CLASSTYPE_N_BASECLASSES (type) > 0)
  3508.     CLASSTYPE_BASECLASSES (type) = (tree *)obstack_copy (obstack, CLASSTYPE_BASECLASSES (type), (CLASSTYPE_N_BASECLASSES (type)+1) * sizeof (tree));
  3509.  
  3510. #ifdef GATHER_STATISTICS
  3511.   tree_node_kinds[(int)lang_type] += 1;
  3512.   tree_node_sizes[(int)lang_type] += sizeof(struct lang_type);
  3513. #endif
  3514. }
  3515.  
  3516. tree
  3517. build_with_cleanup (exp, type, rtl)
  3518.      tree exp;
  3519.      tree type;
  3520.      struct rtx_def *rtl;
  3521. {
  3522.   if (type != NULL_TREE || TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (exp)))
  3523.     {
  3524.       tree rval = make_node (WITH_CLEANUP_EXPR);
  3525.  
  3526.       if (type == NULL_TREE)
  3527.     type = TREE_TYPE (exp);
  3528.  
  3529.       TREE_OPERAND (rval, 0) = exp;
  3530.       TREE_OPERAND (rval, 1) = make_node (RTL_EXPR);
  3531.       TREE_OPERAND (rval, 2) = build_delete (TYPE_POINTER_TO (type),
  3532.                          build1 (ADDR_EXPR, TYPE_POINTER_TO (type), TREE_OPERAND (rval, 1)),
  3533.                          integer_zero_node, LOOKUP_NORMAL, 0);
  3534.       if (rtl != 0)
  3535.     RTL_EXPR_RTL (TREE_OPERAND (rval, 1)) = rtl;
  3536.       if (TREE_CODE (exp) == CALL_EXPR
  3537.       && TREE_VALUE (TREE_OPERAND (exp, 1)) == NULL_TREE)
  3538.     TREE_VALUE (TREE_OPERAND (exp, 1)) = TREE_OPERAND (rval, 1);
  3539.       TREE_TYPE (rval) = type;
  3540.       return rval;
  3541.     }
  3542.   return NULL_TREE;
  3543. }
  3544.  
  3545. void
  3546. dump_time_statistics ()
  3547. {
  3548.   register tree prev = 0, decl, next;
  3549.   int this_time = my_gettime ();
  3550.   TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (this_filename_time))
  3551.     += this_time - body_time;
  3552.  
  3553.   fprintf (stderr, "\n******\n");
  3554.   print_time ("header files (total)", header_time);
  3555.   print_time ("main file (total)", this_time - body_time);
  3556.   fprintf (stderr, "ratio = %g : 1\n",
  3557.        (double)header_time / (double)(this_time - body_time));
  3558.   fprintf (stderr, "\n******\n");
  3559.  
  3560.   for (decl = filename_times; decl; decl = next)
  3561.     {
  3562.       next = IDENTIFIER_GLOBAL_VALUE (decl);
  3563.       IDENTIFIER_GLOBAL_VALUE (decl) = prev;
  3564.       prev = decl;
  3565.     }
  3566.  
  3567.   for (decl = prev; decl; decl = IDENTIFIER_GLOBAL_VALUE (decl))
  3568.     print_time (IDENTIFIER_POINTER (decl),
  3569.         TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (decl)));
  3570. }
  3571.  
  3572. void
  3573. compiler_error (s, v, v2)
  3574.      char *s;
  3575.      int v, v2;            /* @@also used as pointer */
  3576. {
  3577.   char buf[1024];
  3578.   sprintf (buf, s, v, v2);
  3579.   error_with_file_and_line (input_filename, lineno, "%s (compiler error)", buf);
  3580. }
  3581.  
  3582. void
  3583. compiler_error_with_decl (decl, s)
  3584.      tree decl;
  3585.      char *s;
  3586. {
  3587.   char *name;
  3588.   count_error (0);
  3589.  
  3590.   report_error_function (0);
  3591.  
  3592.   if (TREE_CODE (decl) == PARM_DECL)
  3593.     fprintf (stderr, "%s:%d: ",
  3594.          DECL_SOURCE_FILE (DECL_CONTEXT (decl)),
  3595.          DECL_SOURCE_LINE (DECL_CONTEXT (decl)));
  3596.   else
  3597.     fprintf (stderr, "%s:%d: ",
  3598.          DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
  3599.  
  3600.   name = lang_printable_name (decl);
  3601.   if (name)
  3602.     fprintf (stderr, s, name);
  3603.   else
  3604.     fprintf (stderr, s, "((anonymous))");
  3605.   fprintf (stderr, " (compiler error)\n");
  3606. }
  3607.